Link to home
Start Free TrialLog in
Avatar of CC10
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
SOLUTION
Avatar of jackDOTisenberg
jackDOTisenberg
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CC10
CC10

ASKER

it is on

Enable all macros and Trust access to the VBA Project object model
Avatar of CC10

ASKER

Sorry I have checked again and it seems that the macro "Run Macros" is not working properly. I will revert.
Avatar of byundt
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:
Private Sub Workbook_Open()
Application.Run ("RunMacros")
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CC10

ASKER

Thanks. It now works. I awarded 50pts to the first expert because he answered first.