Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Nov 2003
    Posts
    52
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Deleting Bookmarks (Word 2003/VBA)

    I have lots of Word documents that run across my desk that have hundreds of bookmarks in them. [TC (Table of Contents) bookmarks seem most prevalent. I'm sure there is a way to automate their removal instead of deleting each one by hand.

    Thanks in advance for any help here.

  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

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

    Re: Deleting Bookmarks (Word 2003/VBA)

    TC entries are fields, not bookmarks. What exactly do you want to delete - bookmarks, or fields, or both?

  4. #3
    Star Lounger
    Join Date
    Nov 2003
    Posts
    52
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: Deleting Bookmarks (Word 2003/VBA)

    I defnintely need the [TC codes gone.

  5. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Deleting Bookmarks (Word 2003/VBA)

    Interactively:

    - Select Edit | Replace...
    - Enter <code>^d TC</code> in the Find what box.
    - Leave the Replace with box empty.
    - Click Replace All.

    In a macro:

    Sub RemoveTC()
    With ActiveDocument.Content.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "^d TC"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute Replace:=wdReplaceAll
    End With
    End Sub

  6. #5
    Star Lounger
    Join Date
    Nov 2003
    Posts
    52
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Re: Deleting Bookmarks (Word 2003/VBA)

    Thanks Hans! That seems to work.

    I'm assuming that I can delete [TA (table of authories) by substiting "^d[TA" for "^[TC"?

  7. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Deleting Bookmarks (Word 2003/VBA)

    I assume you meant <code>^d TA</code> (on my PC, it looks as if you inserted a square bracket [ between <code>^d</code> and <code>TA</code>. Yes, it should work that waty <code>^d </code> is the code used by Find/Replace for a field.

Posting Permissions

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