T
Tim
I have developed an fairly extensive set of macros to control editing of
documents in Word. One of the requirements is to prevent editing of the
headers, footers, etc... I have developed a class that I instantiate everytime
a document tied to my template is opened
(AutoOpen that calls the CheckClass routine).
This works great except that I find that some of Words native keystrokes no
longer
work. Examples are the "F2" and the "F8" keys.
Appreciate all Help.
Tim
Sub CheckClass() 'Re-initializes Class if not found
If wdApp.MyWord Is Nothing Then
Set wdApp.MyWord = Word.Application
End If
End Sub
'Re-directs entry into a headers to the appropriate Header dialog, prevents
entry into footers
Private Sub MyWord_WindowSelectionChange(ByVal Sel As Selection)
If IsObjectValid(Sel) = False Then Exit Sub
If Sel.StoryType = wdMainTextStory Then Exit Sub
If ActiveDocument.AttachedTemplate <> ThisDocument Then Exit Sub
On Error GoTo ErrTrap
Select Case ActiveWindow.ActivePane.View.SplitSpecial
Case wdPaneComments, wdPaneCurrentPageHeader, _
wdPaneEndnoteContinuationNotice, wdPaneEndnoteContinuationSeparator, _
wdPaneEndnotes, wdPaneEndnoteSeparator, wdPaneEvenPagesFooter, _
wdPaneEvenPagesHeader, wdPaneFirstPageFooter, wdPaneFirstPageHeader, _
wdPaneFootnoteContinuationNotice, wdPaneFootnoteContinuationSeparator, _
wdPaneFootnotes, wdPaneFootnoteSeparator, wdPanePrimaryFooter,
wdPanePrimaryHeader
ActiveWindow.ActivePane.Close
ActiveWindow.View = wdPrintView
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Application.ScreenRefresh
End Select
Select Case Sel.StoryType 'If within a Header or Footer, then Exit
Case wdEvenPagesFooterStory, wdEvenPagesHeaderStory, _
wdFirstPageFooterStory, wdFirstPageHeaderStory, _
wdPrimaryFooterStory, wdPrimaryHeaderStory
ActiveWindow.View = wdPrintView
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Application.ScreenRefresh
Forms.Header 'Routine that provides dialog to entry Header Info
End Select
Exit Sub
ErrTrap:
If Err.Number = 5825 Then Exit Sub 'Object has been deleted.
MsgBox Err.Number & ", " & Err.Description
End Sub
documents in Word. One of the requirements is to prevent editing of the
headers, footers, etc... I have developed a class that I instantiate everytime
a document tied to my template is opened
(AutoOpen that calls the CheckClass routine).
This works great except that I find that some of Words native keystrokes no
longer
work. Examples are the "F2" and the "F8" keys.
Appreciate all Help.
Tim
Sub CheckClass() 'Re-initializes Class if not found
If wdApp.MyWord Is Nothing Then
Set wdApp.MyWord = Word.Application
End If
End Sub
'Re-directs entry into a headers to the appropriate Header dialog, prevents
entry into footers
Private Sub MyWord_WindowSelectionChange(ByVal Sel As Selection)
If IsObjectValid(Sel) = False Then Exit Sub
If Sel.StoryType = wdMainTextStory Then Exit Sub
If ActiveDocument.AttachedTemplate <> ThisDocument Then Exit Sub
On Error GoTo ErrTrap
Select Case ActiveWindow.ActivePane.View.SplitSpecial
Case wdPaneComments, wdPaneCurrentPageHeader, _
wdPaneEndnoteContinuationNotice, wdPaneEndnoteContinuationSeparator, _
wdPaneEndnotes, wdPaneEndnoteSeparator, wdPaneEvenPagesFooter, _
wdPaneEvenPagesHeader, wdPaneFirstPageFooter, wdPaneFirstPageHeader, _
wdPaneFootnoteContinuationNotice, wdPaneFootnoteContinuationSeparator, _
wdPaneFootnotes, wdPaneFootnoteSeparator, wdPanePrimaryFooter,
wdPanePrimaryHeader
ActiveWindow.ActivePane.Close
ActiveWindow.View = wdPrintView
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Application.ScreenRefresh
End Select
Select Case Sel.StoryType 'If within a Header or Footer, then Exit
Case wdEvenPagesFooterStory, wdEvenPagesHeaderStory, _
wdFirstPageFooterStory, wdFirstPageHeaderStory, _
wdPrimaryFooterStory, wdPrimaryHeaderStory
ActiveWindow.View = wdPrintView
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Application.ScreenRefresh
Forms.Header 'Routine that provides dialog to entry Header Info
End Select
Exit Sub
ErrTrap:
If Err.Number = 5825 Then Exit Sub 'Object has been deleted.
MsgBox Err.Number & ", " & Err.Description
End Sub