Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Dec 2000
    Location
    Montreal, Quebec, Canada
    Posts
    115
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Resizing a table column in a footer (Office 2000)

    Hi there,
    I am trying to resize the first column of a table in a footer using VBA. The table is all there is in the footer. I have:

    With .Footers(wdHeaderFooterPrimary)
    Selection.Tables(1).Columns(1).Select
    Selection.Columns.SetWidth ColumnWidth:=InchesToPoints(8.94), rulerstyle:=wdAdjustNone
    End With

    I get an error telling me "The requested member of the collection does not exist".
    Obviously, I forgot to tell VBA something. What?

    Thanks for your help.

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

    Re: Resizing a table column in a footer (Office 2000)

    You don't actually use the With ... End With in your code. Try this:

    With .Footers(wdHeaderFooterPrimary).Range
    .Tables(1).Columns(1).SetWidth ColumnWidth:=InchesToPoints(8.94), RulerStyle:=wdAdjustNone
    End With

    Note that I used a Range instead of Selection.

  3. #3
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Resizing a table column in a footer (Office 2000)

    Your problem is the use of "Selection." which tells word to use the current selection, not the footer. Try

    With ActiveDocument.Sections(1).Footers(wdHeaderFooterP rimary).Range.Tables(1).Columns
    .SetWidth ColumnWidth:=InchesToPoints(8.94), rulerstyle:=wdAdjustNone
    End With

    StuartR

  4. #4
    2 Star Lounger
    Join Date
    Dec 2000
    Location
    Montreal, Quebec, Canada
    Posts
    115
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Resizing a table column in a footer (Office 2000)

    It works!
    Thank you so much.

Posting Permissions

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