Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How can I replace Text in Bookmarks in WORD? Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
02-Jun-03
Category
OLE
Language
Delphi 2.x
Views
89
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Andreas Heidenreich

How can I replace Text in Bookmarks in WORD?

Answer:

When Word is connected via OLE, you can use bookmarks to fill in text into an 
existing template or document. 

The first step is connecting to WORD, either with an OLE-Object or in an 
OLE-Control. 

The Server You connect to should be WORD.Document, not WORD.Application. With this, 
it is easier to control that You always word on the right Document. 

Finding an Replacing a bookmark goes like that: 

1   var
2     Doc: Variant;
3     Result: string;
4     Bookmark: string;
5     Startpos, Endpos: longint;
6   begin
7     // You already are connected to a WORD.Document Object!
8     //
9     Result := 'anything';
10    Bookmark := 'bookmark 20';
11    // Replace the Text:
12    Doc.Bookmarks.Items('bookmark 20').range.text := Result;
13    // done this, You have lost the Bookmark, but integrated the Text
14  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC