BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Word Merg fields

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Phil Barber
Guest





PostPosted: Fri Jan 23, 2004 4:34 pm    Post subject: Word Merg fields Reply with quote



I created a word document and placed a mergeField in it named FNAME
Given the below Code
WordApp := CreateOleObject('Word.application');
WordApp.visible := true;
wordDoc := wordApp.Documents.open('D:Name.doc');
WordDoc.Fields.item(1).result.text := 'Phil';

I can load the FNAME Mergfield with 'Phil' but how do I reference the
Mergfield by Name instead of number (1) ?

Thanks
Phil


Back to top
Oliver Townshend
Guest





PostPosted: Sat Jan 24, 2004 5:34 am    Post subject: Re: Word Merg fields Reply with quote




"Phil Barber" <barber (AT) galtney (DOT) com> wrote

Quote:
I created a word document and placed a mergeField in it named FNAME
Given the below Code
WordApp := CreateOleObject('Word.application');
WordApp.visible := true;
wordDoc := wordApp.Documents.open('D:Name.doc');
WordDoc.Fields.item(1).result.text := 'Phil';

I can load the FNAME Mergfield with 'Phil' but how do I reference the
Mergfield by Name instead of number (1) ?

Insert a bookmark around the field might work, as then you could find the
field within the Bookmark range. If you are just using the field codes to
insert text, rather than actually doing a merge, then it might be simpler to
use Bookmarks, or to use the Forms toolbar to insert FormText fields.

Oliver Townshend



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.