IMPORTANT NOTICE:  As of 21 February, anything posted in this community WILL NOT BE MIGRATED to our new community site.   We have pulled all user information and data from this site and are now in an approximately week long process of importing users, roles, and data to our new site.  We are leaving this site open and active so you can post and hopefully get a response until the migration is complete.   Once complete, the URL  that currently takes you to this site will take you to our new site so your bookmarks will work as always.  Please read the information on a New Login Process

  • Date
  • Date 24 Jan 2019 3:26
  • Replies 0 replies
  • Subscribers 501 subscribers
  • Views 39 views
Product Documentation

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...