Added: Apr 28, 2002
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo
to actually get vb to decipher the correct error description you need to use the format message api eg. Run-time error '-2147220999 (800401f9)':
Highlight all by clicking in box
Const FORMAT_MESSAGE_FROM_SYSTEM = &H1000
Private Declare Function FormatMessage Lib "kernel32" Alias _
"FormatMessageA" ( ByVal dwFlags As Long, lpSource As Long, _
ByVal dwMessageId As Long, ByVal dwLanguageId As Long, _
ByVal lpBuffer As String, ByVal nSize As Long, Arguments As Any) _
Private Function MessageText(lCode As Long) As String
Dim sRtrnCode As String
Dim lRet As Long
sRtrnCode = Space$(256)
lRet = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0&, lCode, 0&, _
sRtrnCode, 256&, 0&)
If lRet >0 Then
MessageText = Left(sRtrnCode, lRet)
MessageText = "Error not found."
End Function ;
No Comments to show
Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.