小智 5
您可以创建自己的函数来处理错误.例如,像这样:
Function FileExists(ByVal AFileName As String) As Boolean
On Error GoTo Catch
FileSystem.FileLen AFileName
FileExists = True
GoTo Finally
Catch:
FileExists = False
Finally:
End Function
Sub Test()
If FileExists("Macintosh HD:Library:User Pictures:Flowers:Flower.tif") Then
MsgBox "File exists"
Else
MsgBox "File doesn't exists"
End If
End Sub
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4516 次 |
| 最近记录: |