Help with modifying VB6 Code to insert page numbers in Word Document - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Help with modifying VB6 Code to insert page numbers in Word Document

HelenSurridgeHelenSurridge Posts: 1Member
Hi,

I have an application which wrote a report to Word 2002. I have just upgraded to Word 2007 and the report fails. I have traced this to the line which is trying to insert the page number at the bottom. This is how the code looked:

Sub CreateFooter()
wdapp.ActiveWindow.View.Type = wdPageView
wdapp.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
wdapp.Selection.Font.Name = "Arial"
wdapp.Selection.Font.Size = 12
wdapp.Selection.Font.bold = True
wdapp.Selection.TypeText Text:="Issued By:" & vbTab & "Date: """
wdapp.NormalTemplate.AutoTextEntries("- PAGE -").Insert wdapp.Selection.Range
wdapp.ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub

The line that fails is:

wdapp.NormalTemplate.AutoTextEntries("- PAGE -").Insert wdapp.Selection.Range

Does anyone know the equivalent for Word 2007 which will correctly insert the page numbers in the footer?

Many thanks for any help you can give!!

Helen.


Sign In or Register to comment.