passing a macro from one workbook to a another workbook

mort1703

Active Member
Joined
Sep 13, 2008
Messages
266
Hi

I am expecting a NO to this question but if its possible I am all ears.

I have excel project I have been working on.

Within the project I create NEW workbooks based on set criteria and this seems to work without problems.

ie
1. Macro A - creates a NEW workbook based on criteria - working already
2. within Macro A - can I pass a module or a different macro to the workbook created within step 1.
3. if step 2 is possible, is it possible to code the transfer within Macro A.

Any help or advice on this one would be appreciated

Thanks
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Why not create a template with the code you want in the new workbooks and then use that when creating those new workbooks?
 
Upvote 0
At the moment I am doing the following
1. run Macro A - this creates the NEW workbook
2. I then add the code manually.

just a thought

could I automate importing a module?
 
Upvote 0
Why don't you create a template workbook with the code and use that when creating the new workbook?

You can use code to import a module to a workbook but it has various implications, for example you would need to lower the security settings to allow programmatic access to VBE.
 
Upvote 0

Forum statistics

Threads
1,222,195
Messages
6,164,514
Members
451,900
Latest member
lamski

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