Solved

How to change a class reference in multiple documents at once

Posted on 2009-07-03
2
134 Views
Last Modified: 2012-05-07
Hi,

I was wondering how you can change a class reference in a Microsoft Word document, in my case hundreds, without having to go through each document and manually change it one by one?

Currently there are numerous documents that I have linked to a class that I created to automate adding a signature to the bottom.  Basically it is reference via: \\server\folder\file and we have recently switched our server to a newer model.  The server name was FS-03 and is now FS-04, so when people try to run these documents it doesn't run the code in the class that is supposed to be referenced.

Any help would be greatly appreciated.

Thanks,

Pat
0
Comment
Question by:agilebiz
2 Comments
 
LVL 15

Accepted Solution

by:
weinberk earned 500 total points
ID: 24774428
Next time, I'd try using a central repository for the code, that updates each pc.  Then don't have the code stored in the 100's of word documents, but have the code run from a single updateable file.  Will be much easier to maintain.
 To use VBA to edit VBA code, you need to use the VBA Extensibility feature.  Detailed information is here: http://www.cpearson.com/excel/vbe.aspx
The page has an example of finding text, but not replacing.  You should be able to modify that code to do a replace, then save, then move on to the next file.  
I don't know where or how these 100's of files are stored, but you might consider listing them all in a text document to make it easier for yourself to iterate through them all.
Another option might be to hack each file using a hex editor, searching for the FS-03 text and replacing it with FS-04.
Hope this helps.
 
0
 

Author Closing Comment

by:agilebiz
ID: 31599595
Had to go through each individually but the info you provided helped.  Set up a centrol location for the code so any changes (ie. new server) we wont need to modify the references.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SLMGR Switches Are Not Working On KMS Host 3 90
VB6 - Convert HH:MM into Decimal 8 54
Visual Studio 2005 text editor 10 38
Protecting vb6 & .Net code Obfuscation 18 121
I'm writing to share my clumsy experience in using this elegant tool so you can avoid every stupid mistake I made. (I leave it to the authorities to decide if this deserves a place in the Knowledge archives.)  Now that I am on the other side of my l…
A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question