VBA: auto_open won't run in add-in

  • I've created my first add-in but have come to my final hurdle.


    I want a new item on my worksheet menu bar to appear every time I open excel. I've written the code in a auto_open macro but the macro doesn't run everytime I open excel.


    What I am doing wrong? :wow:

  • Welcome to the Forum!
    Is the auto_open macro in your add-in? Then it should run when the add-in is loaded (at least mine do). However, Auto_open macros are left over from older versions of Excel. The preferred way is to use the WorkBook Open event macro in the ThisWorkbook section of your add-in. What happens when you cause your Auto_Open macro to run manually? Does the menu item appear?

  • Quote

    Originally posted by Derk
    {snip}, Auto_open macros are left over from older versions of Excel. The preferred way is to use the WorkBook Open event macro in the ThisWorkbook section of your add-in.


    Though the Auto_Open is supported by all versions of xl (AFAIK) -depends what version of xl the OP is using. Workbook_Open appeared in '97?

    <a href="http://www.mrexcel.com/relayforlife.shtml" target="new"><img src="http://www.myimgs.com/data/vonpookie/anne_relay.gif"></a>

  • Work sheet menu bar, do you mean cell right click menu or command bar menu?


    Look at:
    App_WorkbookAddinInstall
    App_WorkbookAddinUninstall


    Add you code in these procedures. Post back if you need / want more help. But drop a note plese to Excel version, i do not have below Xp running right now.


    Jack

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!