Run macro from addin - xlsx workbook

Formula11

Active Member
Joined
Mar 1, 2005
Messages
468
Office Version
  1. 365
Platform
  1. Windows
Is it possible to run a macro from a normal xlsx workbook, with the macro located in an addin.
I've tried using a text box, right-click Assign Macro, this didn't work.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Yes, you can run a macro from an xlsx workbook when all the macro code is located in a xla, xlam, or xlsb workbook. To save an xlsx workbook containing any VBA code you will have to accept that all code will be removed in the save.
 
Upvote 0
Solution
Thanks for replying.
Yes you're right, it was because I had to input path with the right-click, Assign Marco:
VBA Code:
'....folder_path\add_in_name.xlam'!Sub_Name
 
Upvote 0
Would it be possible to run a macro by clicking on a hyperlink?
Again the macro is in the addin and the workbook is xlsx.
 
Upvote 0
Would it be possible to run a macro by clicking on a hyperlink?
Again the macro is in the addin and the workbook is xlsx.
Never done that myself with the macro in an addin installed in the xlsx workbook so I'm not sure.

An alternative would be:
Put the macro in a .xlsm or.xlsb workbook (let's call it WkBkX)​
In a Thisworkbook Workbook_Open module for WkBkX, Call the macro you want to run​
In the xlsx workbook add a hyperlink that, when clicked, opens the WkBkX workbook​
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,213
Members
452,618
Latest member
Tam84

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