Hi,
I have code working to open up file open dialogue box and copy sheet from file opened to active spreadsheet. This is working fine. When the file dialogue box opens and user presses cancel it exits the sub.
Is there a way to get rid of the exit sub and just have it go to next part of code when user presses cancel as I might be opening multiple files. If I get rid of the Exit Sub it crashes and goes to Debug because of the following line Workbooks.Open fn.
Any help appreciated, Here is my code:
MsgBox "Please open admin Fee"
Dim fn
fn = Application.GetOpenFilename
If fn = False Then
MsgBox "File Not Selected: Process Terminated"
Exit Sub
Else
MsgBox "File Selected: " & fn
End If
Workbooks.Open fn
I have code working to open up file open dialogue box and copy sheet from file opened to active spreadsheet. This is working fine. When the file dialogue box opens and user presses cancel it exits the sub.
Is there a way to get rid of the exit sub and just have it go to next part of code when user presses cancel as I might be opening multiple files. If I get rid of the Exit Sub it crashes and goes to Debug because of the following line Workbooks.Open fn.
Any help appreciated, Here is my code:
MsgBox "Please open admin Fee"
Dim fn
fn = Application.GetOpenFilename
If fn = False Then
MsgBox "File Not Selected: Process Terminated"
Exit Sub
Else
MsgBox "File Selected: " & fn
End If
Workbooks.Open fn