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. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 18 Times in 18 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?

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

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 18 Times in 18 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

  5. #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"?

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 18 Times in 18 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
  •