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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field Codes in Word Document

Status
Not open for further replies.

keenanbr

Programmer
Oct 3, 2001
469
IE
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


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top