Help Using VBA To Create A Workbook Containing VBA

Aldk_1

New Member
Joined
Nov 21, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi All, forum newbie looking for some advice....

In simple terms:
  • I have an Excel workbook ("report creation tool") which uses VBA to create multiple new workbooks and email each outputted workbook to a recipient.
  • I want to add a button into each of the outputted workbooks which runs a macro so that the recipients can complete some details then click the button to email the file back to me.
I am encountering issues attempting to attach the required macro in the outputted workbooks to the button in the outputted workbooks.

I have managed to:
  • Add the code within the "report creation tool" workbook which creates the button within the outputted workbooks and imports a module into each outputted workbook containing the macro required when a recipient presses the button (button is assigned to the macro within this code).
However, when the output files are generated the button within them appears to be somehow linking back to the "report creation tool" rather than to the macro within the outputted file that it's been assigned to.

Is there an easy way to do something like this? i.e. Use VBA in one workbook to create another workbook containing a button linked to a macro within it? (recipients would not have access to the "report creation tool" workbook)

I'm no VBA expert so hoping I'm missing something fairly obvious!!

Thanks in advance for any assistance.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
problematic in vb because each user could have a different version of Office that could throw errors.
When the simple solution would be for user to click REPLY and send it back.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
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