I have a macro which populates a page footer. When I print or print preview I see the footer as I want it but if I just display on screen I see the field codes. I would like to see the data rather than the field codes. The macro is
Private Sub PageFooter(ByVal QuoteDate As String)
On Error GoTo errRoutine
If ActiveDocument.ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveDocument.ActiveWindow.Panes(2).Close
End If
If ActiveDocument.ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveDocument.ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveDocument.ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveDocument.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
If Selection.HeaderFooter.IsHeader = True Then
ActiveDocument.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
End If
Selection.TypeParagraph
Selection.TypeText Text:="Page "
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldPage
Selection.TypeText Text:=" of "
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldNumPages
Selection.TypeText Text:=vbTab & vbTab & "Date: " & QuoteDate
'Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldDate
Selection.TypeText Text:=vbTab
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeText Text:="Reference No. " & glbquoteRefNo & vbTab & vbTab & _
"Version " & glbColVal("ISystem_IReleaseNumber")
Exit Sub
errRoutine:
MsgBox ("PageFooter: Error " & Err.Number & " " & Err.Description)
End Sub
Private Sub PageFooter(ByVal QuoteDate As String)
On Error GoTo errRoutine
If ActiveDocument.ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveDocument.ActiveWindow.Panes(2).Close
End If
If ActiveDocument.ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveDocument.ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveDocument.ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveDocument.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
If Selection.HeaderFooter.IsHeader = True Then
ActiveDocument.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
End If
Selection.TypeParagraph
Selection.TypeText Text:="Page "
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldPage
Selection.TypeText Text:=" of "
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldNumPages
Selection.TypeText Text:=vbTab & vbTab & "Date: " & QuoteDate
'Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldDate
Selection.TypeText Text:=vbTab
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeText Text:="Reference No. " & glbquoteRefNo & vbTab & vbTab & _
"Version " & glbColVal("ISystem_IReleaseNumber")
Exit Sub
errRoutine:
MsgBox ("PageFooter: Error " & Err.Number & " " & Err.Description)
End Sub