Kbase P114838: How to use Find/Replace from Microsoft Word with Progress 4GL
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  4/3/2006 |
|
Status: Unverified
GOAL:
How to use Find/Replace from Microsoft Word with Progress 4GL
GOAL:
How to do a Find and Replace in a Word document
FACT(s) (Environment):
Windows
FIX:
The following sample code opens a Word document, Finds the word "test" and replaces it with the word "document". The document is saved with a new name, and then closed. Microsoft Word then quits.
/* Sample Code */
DEFINE VARIABLE l AS LOGICAL INIT TRUE NO-UNDO.
DEFINE VARIABLE oWord AS COM-HANDLE NO-UNDO.
CREATE "Word.Application" oWord.
oWord:Documents:OPEN("C:\test1.doc").
oWord:VISIBLE = TRUE.
/* finds/replaces words until end of document is reached*/
DO WHILE l = TRUE:
/* l = oWord:ActiveDocument:Content:FIND:EXECUTE("<FIND phrase>",,,,,,,,,"<REPLACE phrase>",,,,,). */
l = oWord:ActiveDocument:Content:FIND:EXECUTE("test",,,,,,,,,"document",,,,,).
END.
oWord:ActiveDocument:SaveAs("c:\test2.doc").
oWord:Documents:CLOSE().
NO-RETURN-VALUE oWord:QUIT ().
RELEASE OBJECT oWord.