Hi all
I'm using Delphi 5 OLEServer TWordApplication and TWordDocument as follows:
WA1.Connect;
WA1.Visible := True;
Filename:= 'C:\HPB.dot';
WA1.Documents.Open(Filename,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam);
WD1.ConnectTo(WA1.ActiveDocument);
if WD1.Bookmarks.Exists('Diag') then
begin
st:= 19; nd:= 30;
WD1.Range(st,nd).Select;
WA1.Selection.TypeText('Test text');
end;
What I want to do is select the bookmarked text (bookmark id ='Diag'. In the
above example I have selected it by hardcoding the start and end of the range,
but how can I do it by simply referring to the existing bookmark? I checked out
MSDN and found
ActiveDocument.Bookmarks("temp").Select
at http://msdn2.microsoft.com/en-us/library/aa192170(office.10).aspx , but
WA1.ActiveDocument.Bookmarks('Diag').Select (or WD1.Bookmarks('Diag').Select)
does not work.
Thanks in advance for any help . . .
Best wishes
Steve
***************************************************************************
This e-mail and any files transmitted with it are confidential. If you are not
the intended recipient, any reading, printing, storage, disclosure, copying or
any other action taken in respect of this e-mail is prohibited and may be
unlawful. If you are not the intended recipient, please notify the sender
immediately by using the reply function and then permanently delete what you
have received.
Content of emails received by this Trust will be subject to disclosure under
the Freedom of Information Act 2000, subject to the specified exemptions,
including the Data Protection Act 1998 and Caldicott Guardian principles.
This footnote also confirms that, unless otherwise stated, this email message
has been swept by Sophos Anti-virus for the presence of computer viruses.
***************************************************************************