CC10
asked on
Excel macro does not run on opening
I have seen many answers on this but unfortunately I cannot find the fault.
I automatically open a workbook when Excel opens, using  Option, Advanced, General, at startup open all file in etc...
Then in the ThisWorkbook Object I have inserted:
Private Sub Auto_Open()
Application.Run ("RunMacros")
End Sub
The "RunMacros" macro is inserted in Module1
If I browse through using F8, the Auto_Open macro works but it does not work automatically on opening.
Thanks,
CC
I automatically open a workbook when Excel opens, using  Option, Advanced, General, at startup open all file in etc...
Then in the ThisWorkbook Object I have inserted:
Private Sub Auto_Open()
Application.Run ("RunMacros")
End Sub
The "RunMacros" macro is inserted in Module1
If I browse through using F8, the Auto_Open macro works but it does not work automatically on opening.
Thanks,
CC
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry I have checked again and it seems that the macro "Run Macros" is not working properly. I will revert.
FWIW, an Auto_Open macro normally goes in a regular module sheet rather than in ThisWorkbook code pane.
If you want to keep an equivalent sub in ThisWorkbook, the preferred approach is to use Workbook_Open:
If you want to keep an equivalent sub in ThisWorkbook, the preferred approach is to use Workbook_Open:
Private Sub Workbook_Open()
Application.Run ("RunMacros")
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. It now works. I awarded 50pts to the first expert because he answered first.
ASKER
Enable all macros and Trust access to the VBA Project object model