下面是我在excel2003的VBA帮助中搜索"error collection"得到的
Sub DescriptionX()
Dim dbsTest As Database
On Error GoTo ErrorHandler ' Intentionally trigger an error.
Set dbsTest = OpenDatabase("NoDatabase")
Exit Sub
ErrorHandler:
Dim strError As String
Dim errLoop As Error ' Enumerate Errors collection and display properties of
' each Error object.
For Each errLoop In Errors
With errLoop
strError = "Error #" & .Number & vbCr
strError = strError &" " & .Description & vbCr
strError = strError &" (Source: " & .Source & ")" & vbCr
strError = strError & "Press F1 to see topic " & .HelpContext & vbCr
strError = strError &" in the file " & .HelpFile & "."
End With
MsgBox strError
Next
Resume Next
End Sub
[此贴子已经被作者于2005-5-25 10:39:49编辑过] |