Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft Word OLE Replace Command ???

Status
Not open for further replies.

cj92713696

Programmer
Nov 23, 2000
105
US
I am trying to do something that seems very simple in nature, yet overpowering via code! =) Your help is very much appreciated!

1.) I need Visual Basic to open an existing Microsoft Word document. I have no problems with this part. ;)
2.) I then need Visual Basic to go through the entire loaded document to replace text. If I have an occurence of <<customer>> I'd like to replace that with a customer name via Visual Basic code. As of the moment I'm using the words.item object, but it's really slow. I really need to find out how to use the replace command but have no clue. I am asking for any help you may offer... Thanks a lot!
 
This may not be a direct answer to your question, but it might be a better alternative. From what I gather, you're doing a Mail Merge. You most likely have some kind of database or Excel file that you're using as the source to try to replace peoples names, addresses, phone numbers and company names. If this is the case, then you're in luck!

Microsoft Word already does this for you. Look up Mail Merge in the help file. It's a whole lot faster to do it this way then to write to do the mail merge. The nice this is once you set it up in Word, then you let the user work with the document. Hence there is no code maintence on it.

Just my two cents worth...
Snaggs
tribesaddict@swbell.net

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top