PDA

View Full Version : Solved: Error Numbers



gibbo1715
09-13-2005, 02:57 AM
i am aware there are a number of error numbers that can be used to give my users an error message

eg

Err:
If Err = 53 Then MsgBox "File/Folder not created."

Does anyone have a list of the various error codes available or can tell me where to look

Many Thanks

Gibbo

Bob Phillips
09-13-2005, 03:09 AM
i am aware there are a number of error numbers that can be used to give my users an error message

eg

Err:
If Err = 53 Then MsgBox "File/Folder not created."

Does anyone have a list of the various error codes available or can tell me where to look

Can you not use Err.Description?

gibbo1715
09-13-2005, 03:21 AM
Thanks for the reply, i can yes but i was curious as to a list of the error numbers, i can see it may be useful to me in the future if i require a different outcome dependant on the error number (If that makes sense)

Cheers

Gibbo

TonyJollans
09-13-2005, 04:09 AM
I think a list of errors would be very useful but I have never seen one.

Emily
09-13-2005, 06:08 AM
Sub ListErrors()
Cells.ClearContents
a = 1
Cells(1, 1) = "Error ID"
Cells(1, 2) = "Description"
Cells(1, 3) = "Help Document"
For i = 1 To 1000
On Error GoTo myerror
On Error Resume Next
VBA.Err.Raise i
myerror:
If Err.Description <> tempstr Then
a = a + 1
tempstr = Err.Description
Cells(a, 1) = Err.Number
Cells(a, 2) = Err.Description
Cells(a, 3) = "Help Document>>>"
Cells(a, 4) = Err.HelpFile
Cells(a, 5) = Err.HelpContext
End If
Next
End Sub

gibbo1715
09-13-2005, 06:11 AM
:clap: Really good

Cheers Emily

Gibbo

Philcjr
09-13-2005, 06:20 AM
Gibbo,

Take a look here http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vb98/html/idxRealMsgTrap.asp (you can also find this list by searching "Error" then select "See Also" then select "Trappable Errors". I could not find this list by just searching "Trappable Errors"... go figure :)

I have a complete list of all the "Trappable Errors", I am trying to find the link.