Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Aug 2006
    Location
    Gtr London, England
    Posts
    256
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Delete Bookmarks (VBA - Word 2003)

    Hi,

    Is there a way to delete a bookmark?

    Ive got a macro attached to a word document, in a document management system (DMS),that is actioned when the user closes the document and all works fine without problems. The thing is, the document is saved into the DMS history once run the first time and if the user reviews the document the macro is actioned again when its closed. The macro looks for a particular bookmark in order for it to run.

    To stop this from happening I thought that maybe once the macro finds the bookmark, does its job, the bookmark is deleted, so if the document is reviewed again, when in history, the macro isnt called a second time.

    Is there such a way to delete bookmarks?

    Any help will be grately appreciated.

    Cheers.
    Lee

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Delete Bookmarks (VBA - Word 2003)

    You could add the following line near the end of the macro:

    ActiveDocument.Bookmarks("Test").Delete

    where Test is the name of the bookmark. This line will delete the bookmark, but it won't affect the text of the bookmark.
    This could cause problems if there are REF fields that refer to the bookmark's contents.

  3. #3
    3 Star Lounger
    Join Date
    Aug 2006
    Location
    Gtr London, England
    Posts
    256
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: Delete Bookmarks (VBA - Word 2003)

    Hi Hans,

    Thats great, works a treat.

    Many thanks for your help.

    Regards.
    Lee

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •