K
KR
As a test, I exported a word VBA module, and it appears to be a text file of
the code, with the following header added:
Attribute VB_Name = "Module1"
I have a large amount of information that ends up being hardcoded into my
modules (filling large arrays) because for my purposes, I need to keep
everything in one file instead of pulling it from a database or other file.
Since the VBA interface itself is a pain to update long text strings, I
decided to keep the raw content in excel, then automate getting it into my
word template when I have updated content.
Question 1: In Excel, I can create a text file that has the header (above)
and populate it with the "code" that will fill my arrays. Is there anything
else I need to worry about, or can I create a .bas as a text file (changing
the extension) and then just import it into Word VBA?
Question 2: A minor point, but is there a way in automate Word VBA to delete
a module with a given name, then inport a module of the same name from the
current directory (I can hardcode the directory, that isn't a problem).
Obviously the code would be running from a different module than the one
being deleted/replaced, but I don't know how this could be done.
Sorry if these are dumb questions, I've just never messed with automating
the creation and importing of modules before.
Thanks!
Keith
the code, with the following header added:
Attribute VB_Name = "Module1"
I have a large amount of information that ends up being hardcoded into my
modules (filling large arrays) because for my purposes, I need to keep
everything in one file instead of pulling it from a database or other file.
Since the VBA interface itself is a pain to update long text strings, I
decided to keep the raw content in excel, then automate getting it into my
word template when I have updated content.
Question 1: In Excel, I can create a text file that has the header (above)
and populate it with the "code" that will fill my arrays. Is there anything
else I need to worry about, or can I create a .bas as a text file (changing
the extension) and then just import it into Word VBA?
Question 2: A minor point, but is there a way in automate Word VBA to delete
a module with a given name, then inport a module of the same name from the
current directory (I can hardcode the directory, that isn't a problem).
Obviously the code would be running from a different module than the one
being deleted/replaced, but I don't know how this could be done.
Sorry if these are dumb questions, I've just never messed with automating
the creation and importing of modules before.
Thanks!
Keith