Hello All!
I have a macro that pulls in information from another file via a FileDialog prompt. I added a condition to avoid an error if a file is not selected and now it always prompts to select the file twice or click "cancel" twice. Any thoughts??
Thanks!
I have a macro that pulls in information from another file via a FileDialog prompt. I added a condition to avoid an error if a file is not selected and now it always prompts to select the file twice or click "cancel" twice. Any thoughts??
VBA Code:
Dim fd As Office.FileDialog
Dim strFile As String
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.Filters.Clear
.Filters.Add "Excel Files", "*.xlsm?", 1
.Title = "Choose a File"
.AllowMultiSelect = False
.InitialFileName = "C:\Users\" & Environ("UserName") & "\Desktop"
If .Show = True Then
strFile = .SelectedItems(1)
Workbooks.Open Filename:=strFile, UpdateLinks:=3
End If
If .Show = False Then GoTo SaveAs
End With
Dim WA As Workbook: Set WA = ActiveWorkbook
WA.Sheets("Review").Copy After:=WB.Sheets("Config_Review")
WA.Close SaveChanges:=False
Thanks!