I've been working on a project that includes automating MS Word for reports. I've purchased "Microsoft Office Automation with Visual FoxPro" from Hentzenwerke Publishing and it has been very helpful. However, I have been unable to determine how to Automate the Page X of Y feature that is available interactively in Word.
The following are VBA versions of what I'm trying to do:
Version 1:
Selection.TypeText Text:="Page "
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldPage
Selection.TypeText Text:=" of "
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldNumPages
Version 2:
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
ActiveWindow.ActivePane.VerticalPercentScrolled = 50
ActiveWindow.ActivePane.VerticalPercentScrolled = 0
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
NormalTemplate.AutoTextEntries("Page X of Y"
.Insert Where:=Selection. _
Range, RichText:=True
Selection.TypeParagraph
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldNumPages
Any help in converting to VFP will be appreciated.
CDavis
The following are VBA versions of what I'm trying to do:
Version 1:
Selection.TypeText Text:="Page "
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldPage
Selection.TypeText Text:=" of "
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldNumPages
Version 2:
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
ActiveWindow.ActivePane.VerticalPercentScrolled = 50
ActiveWindow.ActivePane.VerticalPercentScrolled = 0
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
NormalTemplate.AutoTextEntries("Page X of Y"
Range, RichText:=True
Selection.TypeParagraph
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldNumPages
Any help in converting to VFP will be appreciated.
CDavis