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
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