I have a macro that will open a dialog box to allow the user to open another file. There are a couple of things that I need help with. First, I would like the code to open another excel file to run as soon as the user opens this initial file, let's call it Workbook1. Then after the user selects the file that will provide input into Workbook1, let's call it Workbook2, I want Workbook1 to be the file that the user sees again. From there, the user will either select other buttons to run other VB, or other activities. My open file code is below:
' Open a file
Sub Open_File()
Dim sFil As String
Dim sTitle As String
Dim sWb As String
Dim iFilterIndex As Integer
On Error GoTo err_handler
' Set up list of file filters
sFil = "Excel Files (*.xls),*.xls"
' Display *.xls by default
iFilterIndex = 1
' Set the dialog box caption
sTitle = "Select File to Zip"
' Get the filename
sWb = Application.GetOpenFilename(sFil, iFilterIndex, sTitle)
Workbooks.Open Filename:=sWb
Exit Sub
err_handler:
MsgBox "No selection made"
End Sub
Any assistance with this is much appreciated. Thanks in advance.
Bookmarks