Easiest way to execute a macro from Excel Menu

jharding

New Member
Joined
May 30, 2018
Messages
9
I have code written in a VBA Module in Excel. I need to be able to send this xlsm file to other people and when they open it, they can run the macro from a single place. I create a custom tab/group/button on my ribbon, but when I send the file, the tab/group/button isnt there since its a different user profile. I looked up code that would create the custom tab/group/button on workbook open (in the Excel.officeUI file), but when I test it on a different machine with a different user, I get an error when I click on the button saying Excel cant have two workbooks with the same name at the same time. There is no path references in the XML for the file, so not sure why its doing that either:
<mso:customUI xmlns:mso='http://schemas.microsoft.com/office/2009/07/customui'>
<mso:ribbon>
<mso:qat/>
<mso:tabs>
<mso:tab id='reportTab' label='VBA' insertBeforeQ='mso:TabFormat'>
<mso:group id='reportGroup' label='Folders' autoScale='true'>
<mso:button id='runReport' label='Create Folders'
imageMso='CopyFolder' onAction='CreateFolderButtonPress'/>
</mso:group>
</mso:tab>
</mso:tabs>
</mso:ribbon>
</mso:customUI>

Is there any way to link to a Sub in a VBA module that is global (user profile independent)? I know I can go to Developer, then Macros and run it from there, but from a User Interface perspective, I'm looking for one button to hit to execute, that will show on the Excel file all the time
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,215,038
Messages
6,122,798
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top