Option Explicit
Private objFSO As New FileSystemObject
Sub GetDirectory()
Dim WorkbookDir As String
WorkbookDir = ThisWorkbook.Path
' Check wether file exists
' Assume that the file does not exist and is not writeable to begin with
Dim fileIsGood As Boolean
Dim fileObject As Object
' Look for the log file path and make sure that it exists
If objFSO.FileExists(WorkbookDir) Then
WorkbookDir = True
End If
End Sub
答案 0 :(得分:0)
Option Explicit
Private objFSO As New FileSystemObject
Function GetDirectory() as Boolean
Dim WorkbookDir As String
WorkbookDir = ThisWorkbook.Path
' Check wether file exists
' Assume that the file does not exist and is not writeable to begin with
Dim fileIsGood As Boolean
Dim fileObject As Object
' Look for the log file path and make sure that it exists
If objFSO.FileExists(WorkbookDir) Then
WorkbookDir = True
End If
return WorkBookDir
End Function