Private Sub Command1_Click()
Dim FS As Object, F, Fl As String
Set FS = CreateObject("Scripting.FileSystemObject")
If FS.FolderExists(App.Path & "\ABC") = True Then
F = App.Path & "\ABC"
Else
MsgBox "文件夹不存在!", 16, "´错误"
Exit Sub
End If
Fl = F & "\txt.txt"
If FS.FileExists(Fl) = True Then
MsgBox "这个文件存在!", 64, "文件存在"
Else
MsgBox "这个文件不存在!", 16, "错误"
End If
End Sub
这段代码你参考一下吧。我试过了,不错。
if DIR(文件路径)="" then
end
end if
if dir("c:\aaa.txt") ="" then