FileExists 函数

确定数据媒介中是否存在某个文件或目录。

语法:

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