Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to add a table to a footer of a document?

Status
Not open for further replies.

randmeer

Technical User
Nov 1, 2005
7
NL
Hi, can anybody help me with the following question:

Is it possible to add a table to a footer of a document?

I have tried:

With ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary)

Set myRange = .Range(Start:=.Range.Start, End:=.Range.End)
(This code generates a failure.)

Set myTable = .Range.Tables.Add(myRange, 2, 2)
(but I didn't succeed in making a range (myRange) in the footer)

End With

Thanks in advance
Randmeer
 
Have you tried the macrorecorder when you do it manually ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Code:
Sub TableInFooter()
Dim oRange As Word.Range
Dim oTable As Word.Table
Set oRange = ActiveDocument.Sections(1) _
    .Footers(wdHeaderFooterPrimary).Range
Set oTable = oRange.Tables.Add(oRange, 2, 2)
Set oTable = Nothing
Set oRange = Nothing
End Sub

Gerry
 
Thanks a lot,

This code works fine!

Jaap
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top