代码改变世界

VBA 判断文件的路径是否有效的方法

2014-07-25 00:39  xyantelope  阅读(1755)  评论(0)    收藏  举报

Sub aa()
Dim fso
var path = "c:\test.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(path ) Then
MsgBox "路径正确,文件存在"
Else
MsgBox "路径不正确,文件不存在"
End If
End Sub