🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.misc
Article #82

How to find one word in a document and insert text?

#82
From: bart
Date: Wed, 22 Sep 1999 00:00
36 lines
1837 bytes
How to find one word in a document and insert text?

I use word automation in Delphi to start Word and open an existing
document. I got this document from another person so I can not add
bookmarks or add a macro to it. What I must do is find one word in the
document and then add some text after this word. I know I can do this
with the command insertafter, but I don't know how to find this one
word and select/use it to place my text in the document.

I can't find the solution in the VBAWRD8.HLP file :(
All help appreciated . . .

uses Word_tlb;

private
    Msw: _Application;
    Doc: _Document;
end;


procedure ....
var Doc_Name: OleVariant;
begin
    Msw := CoApplication_.Create;
    Msw.Visible := True;

    Doc_Name := 'c:\test.doc';
    Doc :=
Msw.Documents.Open(Doc_name,OleFalse,OleFalse,OleTrue,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,EmptyParam);


    // here comes some other code to manipulate the document.
    // and here I try to insert my text!!!
end;
Technical Details
Message-ID: <OS2G3.2797$h36.514131@amsnews.chello.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff75c,5619a33fc25ec38,start
X-Google-Attributes: gidff75c,public
X-Google-Thread: 10baee,5619a33fc25ec38,start
X-Google-Attributes: gid10baee,public
From: "bart" <wizl@freemail.nl>
Subject: How to find one word in a document and insert text?
Date: 1999/09/22
Message-ID: <OS2G3.2797$h36.514131@amsnews.chello.com>
X-Deja-AN: 528173211
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
X-Trace: amsnews.chello.com 937998894 212.83.68.131 (Wed, 22 Sep 1999 12:14:54 WET DST)
X-MSMail-Priority: Normal
X-Inktomi-Trace: ns02 937995239 18737 212.187.29.10 (22 Sep 1999 10:13:59 GMT)
NNTP-Posting-Date: Wed, 22 Sep 1999 12:14:54 WET DST
Newsgroups: comp.lang.pascal.delphi.misc,borland.public.delphi.database.desktop