vba校验文件是否存在

发布时间 2023-03-23 10:23:09作者: TimeNoMuch
Dim fso As FileSystemObject
Set fso = New FileSystemObject

  If Not fso.FileExists(sPath & sFile) Then
  If bRetry Then
  Beep
  If MsgBox("File, " + sPath + sFile + " , not found!", vbCritical + vbRetryCancel, "File Access Error") = vbCancel Then
    Exit Function
  Else
    GoTo Research
    End If
  End If
Else
  FileExist = True
End If