Dynamically adding vba modules to word application

S

samlotti

Hello,

Im trying to create a word document with a bootstrap vba module that
will insert modules dynamically at runtime. Is there a way to do
this?

The real use cae is that I have a large (1m) in vba template code that
I want to send to a client. But since its so large, Ide like o send
it one and store it locally, the each time they download one of our
documents it is basically a bootstrap that loads the real vba macro.



Thanks
Sam
 
J

Jay Freedman

It's theoretically possible, but Word will fight you all the way if
you try to do it. Code that adds or modifies code is classic virus
behavior, so you have to go to extreme lengths to work around the
security mechanisms.

Fortunately, it isn't necessary for your use case. Simply put your
code into a separate template, and have the client place that template
in their Startup folder (the location is shown in the Tools > Options
File Locations dialog). The template will be loaded as a global
template every time Word starts, and the code will be available in all
documents.
 

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