Importing Modules

C

Carl

Hi guys
Is there a way to replace a module using VBA?
I have about 20 templates that all have the same module
(GenerateTable.bas) which has a bug in it. Rather than
remove the old and import the new manually I want code to
do it (coz I'm lazy).
I'm running Word97.
Also all the template projects are password protected. I'm
guessing VBA can't unprotect then re-protect.
Cheers
Carl
 
J

Jezebel

You can import modules (and forms) through VBA. Check help on the Import
method:

Application.VBE.ActiveVBProject.VBComponents.Import [FileName]

But there's no way to deal with the password through VBA (not that I've ever
found, anyway, and believe me, I've looked!). Nor through VB either, for
that matter. Not even using SendKeys. For future reference, a better
distribution strategy is to put the common code in an add-in. Then you have
only one template to maintain, instead of 20.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top