Article ID: 184742
Article Last Modified on 7/13/2004
Property Description ----------------------------------------------------------------- Number Error number. Description Error message. Line The line number the error occurred on (1 based). Column The column number the error occurred on (0 based). Text* The text of the line that caused the error. Source** What component caused the error. HelpFile*** Help file name provided by the error source. HelpContext*** Help context provided by the error source.
Private Sub Command1_Click()
On Error Resume Next
With ScriptControl1
.Language = "VBScript"
.AllowUI = True
.AddCode Text1.Text
.Run "Test"
End With
If Err Then
MsgBox Err & " " & Error
ListErrors ScriptControl1
End If
End Sub
Private Sub ListErrors(S As ScriptControl)
With S.Error
Debug.Print "Number:", .Number
Debug.Print "Source:", .Source
Debug.Print "Desc:", .Description
Debug.Print "Line: " & .Line, "Column: " & .Column
Debug.Print "Text:", .Text
Debug.Print "Help File:", .HelpFile
Debug.Print "Help Context:", .HelpContext
Debug.Print
End With
End Sub
Sub Test
MsgBox == "Hello World"
Err.Raise 555, "Test", "Custom Error", "test.hlp", 5
End Sub
Number: 1002
Source: Microsoft VBScript compilation error
Desc: Syntax error
Line: 2 Column: 16
Text: MsgBox == "Hello World"
Help File:
Help Context: 0
Number: 555
Source: Test
Desc: Custom Error
Line: 3 Column: 8
Text:
Help File: test.hlp
Help Context: 5
NOTE: The column number may vary depending on whether you cut-and-paste
the code or type it in manually without all the leading spaces.
184739 : INFO: Where to Obtain the Script Control
Additional query words: kbScript kbCtrl kbVBA500 kbVBp400 kbVBp500 kbVBp600 kbVBp kbdsd kbDSupport
Keywords: kbhowto kbscript kbvbp kbgrpdsvb KB184742