Footer for Word 2007

Snoopy

New Member
Joined
Apr 28, 2002
Messages
12
I am trying to get my marco to create a table in the footer section to insert page # of # in the merged top cell, the path and file name in left hand cell of the second row (making the cell large enough to hold the path and file name) and the print date and time in the right hand cell of the second row. The table insert is achieved thru the following macro/script but that is when the script fails. If anyone can offer assistance it would be appreciated.

Sub FooterMay2009()
'
' FooterMay2009 Macro
'
'
WordBasic.ViewFooterOnly
ActiveDocument.AttachedTemplate.BuildingBlockEntries("Bold Numbers 2"). _
Insert Where:=Selection.Range, RichText:=True
Selection.EndKey Unit:=wdLine
Selection.TypeParagraph
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"FILENAME \p ", PreserveFormatting:=True
Selection.TypeText Text:=" "
Selection.InsertDateTime DateTimeFormat:="M/d/yyyy h:mm am/pm", _
insertasField:=True, DateLanguage:=wdEnglishUS, CalendarType:= _
wdCalendarWestern, InsertAsFullWidth:=False
Selection.Font.Size = 8
Selection.Font.Bold = wdToggle
Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
End Sub
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi Snoopy,

I can't see any code in your post to create the table you refer to, or for navigating to the different cells in that table.

However, I'm going to suggest you take a different approach. What I suggest is that you create a template with the layout you require, including the fields, then simply use your macro to create a new document based on that template. There's much less code overhead that way and the template is easier for the typical user to maintain.

Cheers
 
Upvote 0

Forum statistics

Threads
1,225,399
Messages
6,184,747
Members
453,254
Latest member
topeb

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top