ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to replace a VBA module? (https://www.excelbanter.com/excel-programming/336528-macro-replace-vba-module.html)

mrl[_2_]

Macro to replace a VBA module?
 
I have hundreds of spreads with the same code. Is there an easy way to
update the code in all of them, without having to manually edit each one?

It would be nice if this could be done automatically, i.e. have a
template which contains the latest code, and when a spread was opened,
the spread would look at the date when the template was changed, and if
it was changed since the last time the spread was opened, then the
spread would automatically input the new code from the template.

However, this requires a way in VBA to delete a code module and replace
it with a module from another excel file. Is this possible? Thanks. -
Mark


RB Smissaert

Macro to replace a VBA module?
 
Should be quite simple to achieve.
Have a look at this website for starters:
http://www.cpearson.com/excel/vbe.htm

RBS

"mrl" wrote in message
...
I have hundreds of spreads with the same code. Is there an easy way to
update the code in all of them, without having to manually edit each one?

It would be nice if this could be done automatically, i.e. have a template
which contains the latest code, and when a spread was opened, the spread
would look at the date when the template was changed, and if it was
changed since the last time the spread was opened, then the spread would
automatically input the new code from the template.

However, this requires a way in VBA to delete a code module and replace it
with a module from another excel file. Is this possible? Thanks. - Mark



mrl[_2_]

Macro to replace a VBA module?
 
Thanks for the info, much appreciated!

RB Smissaert wrote:
Should be quite simple to achieve.
Have a look at this website for starters:
http://www.cpearson.com/excel/vbe.htm

RBS

"mrl" wrote in message
...

I have hundreds of spreads with the same code. Is there an easy way
to update the code in all of them, without having to manually edit
each one?

It would be nice if this could be done automatically, i.e. have a
template which contains the latest code, and when a spread was opened,
the spread would look at the date when the template was changed, and
if it was changed since the last time the spread was opened, then the
spread would automatically input the new code from the template.

However, this requires a way in VBA to delete a code module and
replace it with a module from another excel file. Is this possible?
Thanks. - Mark




Zack Barresse

Macro to replace a VBA module?
 
Some other resources you may find useful:

http://www.vbaexpress.com/kb/getarticle.php?kb_id=397

http://www.vbaexpress.com/kb/getarticle.php?kb_id=250

HTH

--
Regards,
Zack Barresse, aka firefytr

"mrl" wrote in message
...
I have hundreds of spreads with the same code. Is there an easy way to
update the code in all of them, without having to manually edit each one?

It would be nice if this could be done automatically, i.e. have a
template which contains the latest code, and when a spread was opened,
the spread would look at the date when the template was changed, and if
it was changed since the last time the spread was opened, then the
spread would automatically input the new code from the template.

However, this requires a way in VBA to delete a code module and replace
it with a module from another excel file. Is this possible? Thanks. -
Mark





All times are GMT +1. The time now is 01:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com