VBA code Word Templates

J

jaslegume

The company I work with uses inline forms (static .dot files) as resources
that can be added to a working template. In this context I use the
document.add command and bring these forms into the "working" template
environment. We are now merging with another company and have to make
changes to all these references. And I am not talking about the standard
references that vb programmers are used to. I am talking about places in the
VBA code that do something like this:

document.add "\\root\formdir\form1.dot"

With the merger the form1.dot (in this case) needs to be changed to some
other name. However, there are thousands of these type of references. If
the VBA code was in a text file then this would not be an issue. But as it
is now we need to open each and every .dot to find out where these references
are. What I want to know is this. Is there a way that I can find these
references "enmass" and even change form1 as a part of these search process?
 
A

aidan.heritage

The company I work with uses inline forms (static .dot files) as resources
that can be added to a working template. In this context I use the
document.add command and bring these forms into the "working" template
environment. We are now merging with another company and have to make
changes to all these references. And I am not talking about the standard
references that vb programmers are used to. I am talking about places in the
VBA code that do something like this:

document.add "\\root\formdir\form1.dot"

With the merger the form1.dot (in this case) needs to be changed to some
other name. However, there are thousands of these type of references. If
the VBA code was in a text file then this would not be an issue. But as it
is now we need to open each and every .dot to find out where these references
are. What I want to know is this. Is there a way that I can find these
references "enmass" and even change form1 as a part of these search process?

Been there and got the t-shirt - as a starting point, you might like
to check a program called GlobalFind ( which I think is at
http://www.kgpsoftware.com/gfind.htm ) - this would find the files you
are interested in. My own experience of find and replace has then
been that it is safer to do it manually, though I THINK you should be
able to do it in code.
 
J

jaslegume

Aidan:

The only problem is that this is VBA behind the template. I believe that
this global find does not see this visual basic code.
 
A

aidan.heritage

Aidan:

The only problem is that this is VBA behind the template. I believe that
this global find does not see this visual basic code.







- Show quoted text -

Global find WILL find the reference within the VBA (the only possible
reason it wouldn't is if the VBA is password protected)
 
J

jaslegume

Aidan:

Global Find does not find any code that is in a word template. I have tried
every string there is in the vba editor. I wish it did.
 
A

aidan.heritage

Aidan:

Global Find does not find any code that is in a word template. I have tried
every string there is in the vba editor. I wish it did.






- Show quoted text -

The application that I referred you to called GlobalFind DOES search
within the VBA - for example - this output searches for a routine I
use in code to automate a mainframe process - the function is called
WaitScreen which wouldn't exist outside of the VBA

--------------------------------------------------------------------------------
GlobalFind Results File. 2 result(s) found.
Search Path: t:
Search Query: waitscreen
Replace Query: (Not Specified)
Search Options: Subfolders
Error Code: (None)
--------------------------------------------------------------------------------

File (including partial path):

"TEMPLATE\Word 97 Template\Normal2.dot" Pos: 106854 Line: 178 Column:
82
"TEMPLATE\Word 97 Template\Normal2.dot" Pos: 111174 Line: 189 Column:
905
"TEMPLATE\Word 97 Template\RACC.dot" Pos: 50878 Line: 100 Column: 104
 
J

jaslegume

Aidan:

Once I switched the search to code that has to do with the form it found the
references. However it doesn't seem to work with modules. Anyway thank you
for all your help.
 
R

Russ

See the links here on how to reference and use the extensibility library.
<http://www.google.com/search?q=vba+extensibility>

Type in referenceevents in Word VBA Help for more useful info links.

After referencing the extensibility library the object browser will show
what's available in that VBIDE library.

One pseudocode logic might be to open each template with a loop and export
the .bas and form code, open the exported files in Word and do a find and
replace for needed changes, then import the new code after saving and
removing references to the old code in the VBA Editor, then save and close
the template and get the next.
 
J

jaslegume

aidan:

I do, however, have a solution that I stubled onto. I have been using a
shareware utility for many years and I discovered that it's search function
finds all code in Word Templates.

http://www.ghisler.com/

This explore like utility is the best around and it's search function does
find VBA code
 

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