andymca24 Absent Member.
Absent Member.
1419 views

MS WORD BOOKMARKS

Hi,

I have created a few bookmarks in multiple word docs. I am trying to locate and insert text after the bookmarks, I have that part working. My problem is that I want to look thru the document first to see if the bookmark actually exists. Any help would be greatly appreciated.

0 Likes
4 Replies
Micro Focus Expert
Micro Focus Expert

RE: MS WORD BOOKMARKS

You'd have to verify that this is defined in your Word def file, however it appears there is a method or property ..ActiveDocument.Bookmarks.Exists(strFileName) where strFileName is the name of the bookmark you are searching for.

0 Likes
andymca24 Absent Member.
Absent Member.

RE: MS WORD BOOKMARKS

Hi,

Thanks for your help. I do see that it is the word.def file. Any ideas on how I can set up the cobol syntax for tha to check the returned boolean value. I am just getting started on using this for Word files.

Thanks

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: MS WORD BOOKMARKS

I believe you would use Inquire and the returned boolean indicates whether the bookmark exists or not. What I did was a google search on VB Word searching for bookmarks .. and this article looked promising ... vbadud.blogspot.com/.../check-existence-of-bookmark-using-vba.html

0 Likes
andymca24 Absent Member.
Absent Member.

RE: MS WORD BOOKMARKS

This looks like what I am looking for, any idea s as to what the cobol coding would be, the name of the bookmark I am looking for is "PolicyNumber". Thank you for the help.

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.