?? moderror.bas
字號:
Attribute VB_Name = "modError"
'****************************************
'漢化: 小聰明 coolzm@sohu.com
'小聰明的主頁VB版: http://coolzm.533.net
'****************************************
Option Explicit
'------------------------------------------------------------
' SC Productions
' Name: RFN
' Company: SCP
' Purpose: LogErr
' Parameters: Logs an error in Errors.log in your applications
' directory, and continues running your program.
' Arguments: Three optional strings, which will be logged for
' additional information, if desired.
' Date: June,19 99
'------------------------------------------------------------
Dim lFatal As Boolean
Public Sub LogErr(Optional strInput1 As String, _
Optional strInput2 As String, _
Optional strInput3 As String)
Dim strMsg As String '彈出的錯誤對話框的內容
Dim strTitle As String '彈出的錯誤對話框的標題
Dim OldErrDesc As String
Dim OldErrNum As Long
Dim intFile As Integer
If Err.Number = 0 Then
Exit Sub
Else
'XXXX
End If
OldErrDesc = Err.Description
OldErrNum = Err.Number
If lFatal = True Then
strMsg = "致命的"
Else
strMsg = "未知的"
End If
strMsg = strMsg & " 錯誤: " & Err.Description & vbCrLf & _
vbCrLf & "請聯系你的產品供應商 " & _
"向他們通報你的錯誤"
strTitle = App.Title & " v" & App.Major & "." & App.Minor
strTitle = strTitle & "錯誤號 # " & Err.Number
MsgBox strMsg, vbExclamation + vbOKOnly, strTitle
On Error GoTo ErrWhileLogging:
'致命錯誤
intFile = FreeFile
Open App.Path & "\errors.log" For Append As #intFile
Print #intFile, "----------------------------------------------------"
If lFatal Then
Print #intFile, "Fatal"
Else
Print #intFile, "Non-Fatal"
End If
Print #intFile, " Error in " & App.Path & "\";
Print #intFile, App.Title & " v" & App.Major & "." & App.Minor & " "
'If Not IsNull(strInput1) Then
'Print #intFile, strInput1
'End If
If Not IsNull(strInput2) Then
Print #intFile, strInput2; "XXXXXXXXXXXXXXXXXXXX"
End If
'If Not IsNull(strInput3) Then
'Print #intFile, strInput3
'End If
Print #intFile, Date$ & " " & Time$
Print #intFile, "Error #" & OldErrNum
Print #intFile, "" & OldErrDesc & vbCrLf
Print #intFile, "----------------------------------------------------"
Close #intFile
Exit Sub
ErrWhileLogging:
strMsg = "致命的錯誤" & vbCrLf & _
"請聯系你的產品供應商 " & _
"錯誤信息:" & vbCrLf & vbCrLf & _
"錯誤號 #" & OldErrNum & vbCrLf & _
OldErrDesc
If Not IsNull(strInput1) Then
strMsg = strMsg & vbCrLf & strInput1
End If
If Not IsNull(strInput2) Then
strMsg = strMsg & vbCrLf & strInput2
End If
If Not IsNull(strInput3) Then
strMsg = strMsg & vbCrLf & strInput3
End If
MsgBox strMsg
End
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -