Skip to main content

MS WORD BOOKMARKS

  • January 31, 2013
  • 4 replies
  • 0 views

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.

4 replies

Stephen Hjerpe
  • Participating Frequently
  • 1100 replies
  • January 31, 2013

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.

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.


  • Author
  • Rocketeer
  • 19312 replies
  • January 31, 2013

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.

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


Stephen Hjerpe
  • Participating Frequently
  • 1100 replies
  • January 31, 2013

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.

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


  • Author
  • Rocketeer
  • 19312 replies
  • February 7, 2013

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.

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.