K
Kim
Hi,
While testing my vba script on word 2007, I found that autotextentries "x of
y" does not work. The source code is like this:
With RptDoc.Sections(1)
With .Footers(wdHeaderFooterPrimary)
.Range.Select
.Range.Borders(wdBorderTop).Visible = True
.Range.Font.Size = 10
.Range.ParagraphFormat.Alignment = wdAlignParagraphLeft
Selection.TypeText Text:="Footer "
NormalTemplate.AutoTextEntries("Page X of Y").Insert
Where:=Selection.Range
End With
' Close the footer pane
While ActiveWindow.View.SplitSpecial <> wdPaneNone
ActiveWindow.Panes(2).Close
Wend
End With
The script runs fine on word 2003 and I can see the Page X of Y in the
footer. If I run the same script on word 2007, the script does not raise any
errors but where Page X of Y should appear is blank.
Would you let me know if I should update any parts of my vba script for word
2007? Is "NormalTemplate.AutoTextEntries("Page X of Y").Insert
Where:=Selection.Range" no longer valid in word 2007?
Thank you in advance,
-- mk
While testing my vba script on word 2007, I found that autotextentries "x of
y" does not work. The source code is like this:
With RptDoc.Sections(1)
With .Footers(wdHeaderFooterPrimary)
.Range.Select
.Range.Borders(wdBorderTop).Visible = True
.Range.Font.Size = 10
.Range.ParagraphFormat.Alignment = wdAlignParagraphLeft
Selection.TypeText Text:="Footer "
NormalTemplate.AutoTextEntries("Page X of Y").Insert
Where:=Selection.Range
End With
' Close the footer pane
While ActiveWindow.View.SplitSpecial <> wdPaneNone
ActiveWindow.Panes(2).Close
Wend
End With
The script runs fine on word 2003 and I can see the Page X of Y in the
footer. If I run the same script on word 2007, the script does not raise any
errors but where Page X of Y should appear is blank.
Would you let me know if I should update any parts of my vba script for word
2007? Is "NormalTemplate.AutoTextEntries("Page X of Y").Insert
Where:=Selection.Range" no longer valid in word 2007?
Thank you in advance,
-- mk