I am trying to open a file dialog in excel so the user can select a file. For some reason, I keep getting a runtime error after I select the file I need. Here is the code:
Dim dartFile As String dartFile = Application.GetOpenFilename _ (Title:="Please choose DART output to open", _ FileFilter:="Excel Files *.xlsx* (*.xlsx*),") If dartFile = False Then MsgBox "No file selected.", vbExclamation, "Sorry!" Exit Sub Else 'Run the rest of the Sub End IF
An error pops up when I select a valid .xlsx file and the debugger says something is wrong on this line:
If dartFile = False Then
Any help would be appreciated.
source share