S
sandy
I found Bill Coan's article regarding locking
header/footer programatically, my proble is that I don't
know what to "customize" and what to keep as code.
If someone can tell me what I am supposed to "customize"
in the code below, I would greatly appreciate it.
Thanks so much,
BTW - Happy Mother's Day
sandy
Option Explicit
'reserve memory for an application variable
Private WithEvents wdApp As Word.Application
Private Sub Document_New()
'assign Word to the application variable
If wdApp Is Nothing Then
Set wdApp = ThisDocument.Application
End If
End Sub
-----------------------------------------------------------
---------------------
Private Sub Document_Open()
'assign Word to the application variable
If wdApp Is Nothing Then
Set wdApp = ThisDocument.Application
End If
End Sub
-----------------------------------------------------------
---------------------
Private Sub wdApp_WindowSelectionChange(ByVal Sel As
Selection)
'quit if active doc isn't attached to this template
If ActiveDocument.AttachedTemplate <> ThisDocument
Then Exit Sub
'get out of the header/footer if we're in it
Select Case Sel.StoryType
Case wdEvenPagesFooterStory, wdEvenPagesHeaderStory, _
wdFirstPageFooterStory,
wdFirstPageHeaderStory, _
wdPrimaryFooterStory, wdPrimaryHeaderStory
ActiveWindow.ActivePane.View.SeekView =
wdSeekMainDocument
Exit Sub
Case Else
End Select
End Sub
header/footer programatically, my proble is that I don't
know what to "customize" and what to keep as code.
If someone can tell me what I am supposed to "customize"
in the code below, I would greatly appreciate it.
Thanks so much,
BTW - Happy Mother's Day
sandy
Option Explicit
'reserve memory for an application variable
Private WithEvents wdApp As Word.Application
Private Sub Document_New()
'assign Word to the application variable
If wdApp Is Nothing Then
Set wdApp = ThisDocument.Application
End If
End Sub
-----------------------------------------------------------
---------------------
Private Sub Document_Open()
'assign Word to the application variable
If wdApp Is Nothing Then
Set wdApp = ThisDocument.Application
End If
End Sub
-----------------------------------------------------------
---------------------
Private Sub wdApp_WindowSelectionChange(ByVal Sel As
Selection)
'quit if active doc isn't attached to this template
If ActiveDocument.AttachedTemplate <> ThisDocument
Then Exit Sub
'get out of the header/footer if we're in it
Select Case Sel.StoryType
Case wdEvenPagesFooterStory, wdEvenPagesHeaderStory, _
wdFirstPageFooterStory,
wdFirstPageHeaderStory, _
wdPrimaryFooterStory, wdPrimaryHeaderStory
ActiveWindow.ActivePane.View.SeekView =
wdSeekMainDocument
Exit Sub
Case Else
End Select
End Sub