I’m trying to open a woorkbook in the background in a macro. When the user exits the open file dialog, I want the program to quit, of course.
But every attempt of doing so failed…
' Get the file to open
tempFile = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
What I tried so far:
' Catch abort of the open file dialog
If IsEmpty(tempFile) Then
End
End If
' Catch abort of the open file dialog
If IsEmpty(tempFile) Or Not tempFile Then
End
End If
' Catch abort of the open file dialog
If IsEmpty(tempFile) Or Not CBool(tempFile) Then
End
End If
' Catch abort of the open file dialog
If IsEmpty(tempFile) Or tempFile Like "false" Then
End
End If
No matter what, I always get a “Type mismatch” error.
1 Answer