I have 2 kinds of workbooks that must be opened in order. However, I cannot specify the workbooks in the code because they will always be different files (Master file opened first followed by subsidiary file) so I am using the workbook index since there will only be 2 files opened at a time and they must be opened in a certain order. I dont know why the following code isnt working; I've tried activeworkbook with no success as well.
Private Sub Workbook_Open()
If ThisWorkbook <> Workbooks(1) Then
MsgBox ("PLEASE CLOSE ALL OTHER EXCEL FILES FIRST.")
ThisWorkbook.Close
End If
End Sub
Then I would apply similar code to the 2nd workbook except with Workbooks(2) and a different msgbox.
Any help is MUCH appreciated.
Thank you.
Luke
Bookmarks