dabeachboy
asked on
Adding "Page X of Y" auto text to a page footer
Hi there, I'm new around here. Hope someone can offer some help with this question.
I'm developing a Word 2000 automation program using Visual FoxPro 6.0, and a little nagging problem I haven't solved yet is inserting the auto text "Page X of Y" into the page footer of the document. Anyone know the easiest way to do this?
I'm developing a Word 2000 automation program using Visual FoxPro 6.0, and a little nagging problem I haven't solved yet is inserting the auto text "Page X of Y" into the page footer of the document. Anyone know the easiest way to do this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hey xSinbad,
Thanks a bunch for posting your sample. I still needed to make a couple of tweaks and translate it into VFP language but it definitely helped me get on the right track.
For your notes in case anyone needs to do something similar:
1) 'wdPageView' should have been 'wdPrintView' -- unless of course the constants are named differently in different versions of Word. What do I know, right? I've only been writing Word automation programs for about a week. Search for it in the Object Browser.
2) The "Page X of Y" auto-text should be added as follows:
NormalTemplate.AutoTextEnt ries("Page X of Y").Insert Where := Selection. _
Range
Thanks again!
Thanks a bunch for posting your sample. I still needed to make a couple of tweaks and translate it into VFP language but it definitely helped me get on the right track.
For your notes in case anyone needs to do something similar:
1) 'wdPageView' should have been 'wdPrintView' -- unless of course the constants are named differently in different versions of Word. What do I know, right? I've only been writing Word automation programs for about a week. Search for it in the Object Browser.
2) The "Page X of Y" auto-text should be added as follows:
NormalTemplate.AutoTextEnt
Range
Thanks again!
If ActiveWindow.ActivePane.Vi
ActivePane.View.Type = wdOutlineView Or ActiveWindow.ActivePane.Vi
= wdMasterView Then
ActiveWindow.ActivePane.Vi
End If
ActiveWindow.ActivePane.Vi
Selection.WholeStory
Selection = strHeader
ActiveWindow.ActivePane.Vi