L
Lars
I am developing an MS Word (xp) template for a corporate letterhead that will
automatically insert the reference number (already stored in a variable from
the first page) into the header of the second (and subsequent) pages.
I am aware that there is no "new page" event in Word that can be caught.
The solution I am working on involves checking the
'ActiveDocument.BuiltInDocumentProperties("number of pages")' property and
running the code as soon as the page number has incremented. Unfortunately, I
cannot find a way of checking this value each time the user types a new
character.
Here is the code I am using at this time :
Option Explicit
Private WithEvents wdApp As Word.Application
Dim page1 As Integer
Dim page2 As Integer
'This line is executed during the loading of the document
page1 = ActiveDocument.BuiltInDocumentProperties("number of pages")
Private Sub wdApp_WindowSelectionChange(ByVal Sel As Selection)
page2 = ActiveDocument.BuiltInDocumentProperties("number of pages")
If page2 > page1 Then
MsgBox "Now on page " & Format(page2)
'Do the necessary operation here...
automatically insert the reference number (already stored in a variable from
the first page) into the header of the second (and subsequent) pages.
I am aware that there is no "new page" event in Word that can be caught.
The solution I am working on involves checking the
'ActiveDocument.BuiltInDocumentProperties("number of pages")' property and
running the code as soon as the page number has incremented. Unfortunately, I
cannot find a way of checking this value each time the user types a new
character.
Here is the code I am using at this time :
Option Explicit
Private WithEvents wdApp As Word.Application
Dim page1 As Integer
Dim page2 As Integer
'This line is executed during the loading of the document
page1 = ActiveDocument.BuiltInDocumentProperties("number of pages")
Private Sub wdApp_WindowSelectionChange(ByVal Sel As Selection)
page2 = ActiveDocument.BuiltInDocumentProperties("number of pages")
If page2 > page1 Then
MsgBox "Now on page " & Format(page2)
'Do the necessary operation here...