V
vrzimmerm
The following macro segment is supposed to detect if the user
cancelled out of an "Open File" input window, but I keep getting a
"subscript out of range" error. What am I doing wrong?
Dim FName As Variant
FName = Application.GetOpenFilename("Excel Files (*.xls),*.xls")
If Not FName = False Then Workbooks.Open FName
Application.DisplayAlerts = False
If FName <> False Then
Set wb = Workbooks.Open(FName)
MsgBox "File open cancelled"
wb.Close
End If
Thanks.
cancelled out of an "Open File" input window, but I keep getting a
"subscript out of range" error. What am I doing wrong?
Dim FName As Variant
FName = Application.GetOpenFilename("Excel Files (*.xls),*.xls")
If Not FName = False Then Workbooks.Open FName
Application.DisplayAlerts = False
If FName <> False Then
Set wb = Workbooks.Open(FName)
MsgBox "File open cancelled"
wb.Close
End If
Thanks.