I have a piece of code which just has the user select a file that is imported into the current workbook as a new worksheet.
If the user doesnt actually select a file and click OK but instead clicks cancel, this then causes all other code not to run. Seems to affect Worksheet events like Worksheet SelectionChange and Worksheet_Change. This is the code...
Any help would be appreciated. Thanks in advance.
Al
If the user doesnt actually select a file and click OK but instead clicks cancel, this then causes all other code not to run. Seems to affect Worksheet events like Worksheet SelectionChange and Worksheet_Change. This is the code...
Code:
Sub GetFilePath()
Dim TrackerName As String
Set myFile = Application.FileDialog(msoFileDialogOpen)
With myFile
.Title = "Choose the RRAR to be imported"
.AllowMultiSelect = False
If .Show <> -1 Then
Exit Sub
End If
RRAR_File = .SelectedItems(1)
End With
Application.Workbooks.Open (RRAR_File)
RRAR_Filename = Dir(RRAR_File)
TrackerName = ThisWorkbook.Name
Windows(TrackerName).Activate
'Windows.Arrange ArrangeStyle:=xlHorizontal
Windows(RRAR_Filename).Activate
Sheets(1).Name = "RRAR_Form"
'Copy the RRAR Form to the RRAR Tracker
Sheets("RRAR_Form").Copy After:=Workbooks(TrackerName).Sheets(1)
'Sheets("RRAR_Form").Copy After:=Workbooks("RRAR_And_Candidate_Tracker DEVELOPMENT 05.xlsm").Sheets(1)
Application.DisplayAlerts = False
Windows(RRAR_Filename).Close
Application.DisplayAlerts = True
ActiveWindow.WindowState = xlMaximized
End Sub
Any help would be appreciated. Thanks in advance.
Al