Я пытаюсь открыть woorkbook на заднем плане в макросе. Когда пользователь выходит из диалогового окна открытия файла, я, конечно, хочу, чтобы программа завершила работу.
Но каждая попытка этого не удалась ...
' Get the file to open
tempFile = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
Что я пробовал до сих пор:
' 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
Несмотря ни на что, я всегда получаю сообщение об ошибке "Несоответствие типов".