Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    May 2005
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Delete Table in Footer (Word XP - VBA)

    I need to be able to programmically open up the footer of a document, select the table that is there, and then delete that table from both the FooterFirst and FooterPrimary. I would have thought this would be easy; however, I am having some difficulty with it. For one thing, there are tables within the body of the document. Any assitance would be greatly appreciated. Thanks.

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

    Re: Delete Table in Footer (Word XP - VBA)

    Try this:

    Sub DeleteTablesInFooters()
    Dim sec As Section
    Dim ftr As HeaderFooter
    Dim i As Integer
    For Each sec In ActiveDocument.Sections
    For Each ftr In sec.Footers
    If ftr.Exists Then
    For i = ftr.Range.Tables.Count To 1 Step -1
    ftr.Range.Tables(i).Delete
    Next i
    End If
    Next ftr
    Next sec
    End Sub

  3. #3
    Star Lounger
    Join Date
    May 2005
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete Table in Footer (Word XP - VBA)

    Thanks, Hans. I am very grateful!

  4. #4
    Star Lounger
    Join Date
    May 2005
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete Table in Footer (Word XP - VBA)

    Just following up. I used the code in my module and it works perfectly. I also discovered that I could use the "DifferentFirstPageHeaderFooter=False" to delete something from a header (as long as the intent was to not have a different first page on the end product). Thanks, again!!

Posting Permissions

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