Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
LarryC Contributor.
Contributor.
248 views

ActiveX to Search and Replace in MS-Word

I have a routine that creates MS Word Documents that works just find setting fonts, tabs formatting etc.
It is using ActiveX controls.
I am trying to introduce a function that will do "Find and Replace" and am going through grief trying to get it to work.
Here is the AcuCobol logic I am trying to use:
 
 
01 WORD-DOC-RANGE-HANDLE     HANDLE OF RANGE.
 
     MOVE LOW-VALUES TO WS-REPLACED-TEXT, WS-REPLACEMENT-TEXT.
     STRING "Vancouver"           DELIMITED BY SIZE INTO WS-REPLACED-TEXT.
     STRING "NeverNever Land" DELIMITED BY SIZE INTO WS-REPLACEMENT-TEXT.
 
     MODIFY PRIMARY-WORD-APPLICATION-HANDLE  Documents::Add() GIVING WORD-DOC-HANDLE.
     INQUIRE WORD-DOC-HANDLE CONTENT IN WORD-DOC-RANGE-HANDLE. 
     USE WORD-DOC-RANGE-HANDLE @Find
     MODIFY  ^@Text = WS-REPLACED-TEXT
                   ^@Replacement::@text = WS-REPLACEMENT-TEXT
                   ^@MatchCase = 0
                   ^@MatchWholeWord = 0
                   ^@MatchWildcards = 0
                    ^@MatchSoundsLike = 0
                    ^@MatchAllWordForms = 0
                    ^@Forward = 1
                    ^@Wrap = 0
    END-USE.
    MODIFY WORD-DOC-RANGE-HANDLE @Find::EXECUTE (1, 0, 0, 0, 0, 0, 1, 0, 0, 1).
 
Thanks for your assistance...
 

LarryGeeked

Tags (1)
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.