Welcome to the board!
Please use code tags when posting code. Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.
Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
I would attempt to do something like this.
Sub Open_File()
Dim WBSrc As Workbook
Dim WBDest As Workbook
Dim sFil As String
Dim sTitle As String
Dim sWb As String
Dim iFilterIndex As Integer
On Error GoTo err_handler
Set WBSrc = ThisWorkbook
' 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)
If sWb <> False Then
Application.ScreenUpdating = False
Set WBDest = Workbooks.Open(Filename:=sWb)
WBSrc.Activate
Application.ScreenUpdating = True
End If
Exit Sub
err_handler:
MsgBox "No selection made"
End Sub
This assigns your workbooks to variables so when you refer to them, you will always be assured that any references will be to the correct workbook. You don't have to worry which workbook is actually activated.
Bookmarks