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 / Mailmerge and Fax / November 2003

Tip: Looking for answers? Try searching our database.

Renaming a Mergefield using Delphi 6

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
J - 12 Nov 2003 13:26 GMT
Hi,

How do I search and rename a mergefield in word using Delphi 6? I can search
for the text in
the document and also find the field using

word.ActiveDocument.Fields.item(1).select

but how do I rename it and carry on searching through the doc to find and
rename more fields??

Thanks

J
Cindy M  -WordMVP- - 12 Nov 2003 17:17 GMT
Hi J,

> How do I search and rename a mergefield in word using Delphi 6? I can search
> for the text in
[quoted text clipped - 4 lines]
> but how do I rename it and carry on searching through the doc to find and
> rename more fields??

Easiest would probably be to modify the fields' .Code property. I might use

For Each fld in ActiveDocument.Fields
   If fld.Type = wdFieldMergefield
'note: check the wd as I typed from memory
       fld.Code = "Mergefield " & szNewName

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
 
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.