I am trying to run a Macro at startup that will close a previous linked workbook (named MainMenu). I have the following code:
If I leave as is, I receive Compile Error: expected end sub with the first line.
If I remove the SubCloseMainMen u(), I receive an error which states Run-time error '9': Subscript out of range
Does anyone know how to fix this code or know a better code to use? Thanks.
Code:
Private Sub Workbook_Open()
Sub CloseMainMenu()
Windows("Filename.xlsm").Activate
ActiveWindow.WindowState = xlNormal
ActiveWindow.Close
End Sub
If I remove the SubCloseMainMen u(), I receive an error which states Run-time error '9': Subscript out of range
Does anyone know how to fix this code or know a better code to use? Thanks.