Can I update my ThisWorkbook Module from within the module itself?

TheRedCardinal

Board Regular
Joined
Jul 11, 2019
Messages
243
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
I have a set up like this:

  • 1 Central Maintained Control Spreadsheet
  • Several (10+) specific and customised Workbook
When the customised workbooks open, they delete 3 VBA modules (Command, Command and Security) and re-import the latest modules from a centralised repository. They are saved as .bas files there. It works great.

The update comes from a Workbook_Open sub in the ThisWorkbook module.

Now I went to update the ThisWorkbook subs centrally as well. I have a ThisWorkbook .cls file in the same central repository.

But I'm running into problems with basically trying to update the ThisWorkbook subs from a sub contained therein.

Is there a way to do this from within the ThisWorkbook Open_Sub routine (there are other routines to import as well), or do I need to write a new workbook which basically pushes the update out to the files?
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
There may be other methods of accomplishing your goal ... but for what it is worth ... as an experiment in personal learning, I did change a macro in
another workbook. So to answer your question "push the updated macro out to the files" ... that would be yes.

Our you might consider simply replacing the entire workbook with a new workbook that includes the needed data. The new workbook would have
the updated macro within.
 
Upvote 0
Thanks @Logit

I can replace the workbooks but as I'd need to do them one by one this is not a good plan. I was hoping for a single button solution, or to imbed it into the workbook itself.

I will work on the "push" solution for now.
 
Upvote 0

Forum statistics

Threads
1,215,516
Messages
6,125,284
Members
449,218
Latest member
Excel Master

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