Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2007

Tip: Looking for answers? Try searching our database.

VBA code Word Templates

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jaslegume - 02 Aug 2007 14:52 GMT
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?
aidan.heritage@virgin.net - 02 Aug 2007 15:53 GMT
On 2 Aug, 14:52, jaslegume <jasleg...@discussions.microsoft.com>
wrote:
> 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
[quoted text clipped - 12 lines]
> 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.
jaslegume - 02 Aug 2007 16:20 GMT
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.

> 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
[quoted text clipped - 12 lines]
> 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?
aidan.heritage@virgin.net - 02 Aug 2007 21:21 GMT
On 2 Aug, 16:20, jaslegume <jasleg...@discussions.microsoft.com>
wrote:
> Aidan:
>
[quoted text clipped - 19 lines]
>
> - 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)
jaslegume - 03 Aug 2007 04:34 GMT
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.

> On 2 Aug, 16:20, jaslegume <jasleg...@discussions.microsoft.com>
> wrote:
[quoted text clipped - 24 lines]
> Global find WILL find the reference within the VBA (the only possible
> reason it wouldn't is if the VBA is password protected)
aidan.heritage@virgin.net - 03 Aug 2007 11:24 GMT
On 3 Aug, 04:34, jaslegume <jasleg...@discussions.microsoft.com>
wrote:
> Aidan:
>
[quoted text clipped - 32 lines]
>
> - 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
jaslegume - 03 Aug 2007 13:26 GMT
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.

> On 3 Aug, 04:34, jaslegume <jasleg...@discussions.microsoft.com>
> wrote:
[quoted text clipped - 56 lines]
> 905
> "TEMPLATE\Word 97 Template\RACC.dot" Pos: 50878 Line: 100 Column: 104
jaslegume - 05 Aug 2007 17:02 GMT
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

> On 3 Aug, 04:34, jaslegume <jasleg...@discussions.microsoft.com>
> wrote:
[quoted text clipped - 56 lines]
> 905
> "TEMPLATE\Word 97 Template\RACC.dot" Pos: 50878 Line: 100 Column: 104
Russ - 05 Aug 2007 05:09 GMT
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.

> 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
[quoted text clipped - 12 lines]
> 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?

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.