マクロのバックグラウンドで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
、どんな。また
さらに、http://msdn.microsoft.com/en-us/library/bb209892(v=office.12).aspxを参照してください。記事によると、戻り値の型は変種です。 – Fionnuala