FileExists Function

確定資料媒體中是否存在某個檔案或目錄。

語法

FileExists (FileName As String | DirectoryName As String)

傳回值類型

布林型

參數:

FileName | DirectoryName:包含明確檔案定義的任意字串型表示式。也可以使用 URL 表示法

錯誤代碼:

5 無效的程序呼叫

示例:

Sub ExampleFileExists

    MsgBox FileExists("C:\autoexec.bat")

    MsgBox FileExists("file:///d|/bookmark.htm")

    MsgBox FileExists("file:///d|/Private")

End Sub