Programmatically Replace VBA Code

Programmatically Replace VBA Code

Post by Stev » Fri, 05 May 2006 07:52:08

I have made important changes to the VBA logic in a template. I want
that same logic to be copied to over 100 drawings that already exist.
I can open each drawing and past the new logic in, but, mercy, that
will take a long time.

Is there a way to programmatically open each existing drawing and
replace the existing VBA code with the new VBA code in a template?


Programmatically Replace VBA Code

Post by SnVuZVRoZV » Fri, 05 May 2006 10:21:01

In VBAUnit it rewrite a part itsself. It might be an example.



Programmatically Replace VBA Code

Post by John » Fri, 05 May 2006 21:17:32


Also look up "VBProject" in help. This is a property of the Document
object. You could write a routine in a separate document to iterate through
a group of files and replace the code using this method.

As an aside, keeping code in a stencil rather than the document is often a
better plan if you can, for reasons you are now discovering. Maybe you
could make this change now if you've got to go through the files anyway?

Hope that helps

Best regards