vba - Excel Addins - Not Modifying Toolbar -
vba - Excel Addins - Not Modifying Toolbar -
i looking best way deploy excel macros users. goal create super easy end users install , promote utilize adding addin toolbar. know there number of help articles on topic couldn't find covered exact issue. can please help , excuse me if noobie question. please see below replication steps issue.
i have added code below worksheet event on "this worksheet" of excel macro file i add together main code module references i save .xlam in addin roaming folder i enable addin in excel 2013 after install adds button add together in tab it works until close excel in case button disappears it still under active add together ins not on toolbarthe code:
option explicit dim ccontrol commandbarbutton private sub workbook_addininstall() on error resume next 'just in case 'delete existing menu item may have been left. application.commandbars("worksheet menu bar").controls("super code").delete 'add new menu item , set commandbarbutton variable set ccontrol = application.commandbars("worksheet menu bar").controls.add 'work variable ccontrol .caption = "convert survey reporter tables" .style = msobuttoncaption .onaction = "cmb_general_table_formatting" 'macro stored in standard module end on error goto 0 end sub private sub workbook_addinuninstall() on error resume next 'in case has gone. application.commandbars("worksheet menu bar").controls("convert survey reporter tables").delete on error goto 0 end sub
the workbook_addininstall event fires when check box install in add-ins dialog (and workbook_addinuninstall fires when uncheck it). these useful performing 1 time functions such creating/removing dedicated temporary directory, etc.
to load commandbarbutton every time excel opened you'll need move workbook_addininstall code workbook_open event.
vba excel-vba excel-addins
Comments
Post a Comment