我在Globals.bas中有以下代码:
Public Const strErrorLog = "log.log"
Public Sub WriteLog(ByVal strMess As String, ByVal ErrLog As String)
Dim intLogFile As Integer
On Error GoTo GenErr
'Print the path of the log file
If ErrLog <> "" Then
' save errors to a text file
intLogFile = FreeFile
Open ErrLog For Append As #intLogFile
Print #intLogFile, Str(Now) & " " & strMess
Close intLogFile
End If
Exit Sub
GenErr:
Select Case ShowError(Err, Error$ & " in WriteLog", strErrorLog)
Case vbAbort: Exit Sub: Case vbIgnore: Resume Next: Case vbRetry: Resume
End Select
End Sub
如何获取日志文件的完整路径,因为应用程序似乎没有写入正确的位置。