以下代码检查文件是否存在相同文件夹中
Sub Check_File()
MyPath = ThisWorkbook.Path & "\"
MyFile="myF.xls"
If Dir(MyPath & MyFile, vbDirectory) = "" Then
MsgBox MyPath & MyFile& "不存在!"
Exit Sub
End If
End sub
以下代码检查文件是否存在相同文件夹中
Sub Check_File()
MyPath = ThisWorkbook.Path & "\"
MyFile="myF.xls"
If Dir(MyPath & MyFile, vbDirectory) = "" Then
MsgBox MyPath & MyFile& "不存在!"
Exit Sub
End If
End sub
转载于:https://my.oschina.net/tedzheng/blog/1931479