Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
[email protected] robertadamharper@googlemail.com is offline
external usenet poster
 
Posts: 1
Default Has anyone got the code below to work? - How can I prevent users from editing the header of a document in Word 2000 or higher?

Has anyone got the code below to work? If you have, please could you
give me a detailed steps into getting it to work

http://word.mvps.org/faqs/customization/
ProtectWord2000PlusHeader.htm


How can I prevent users from editing the header of a document in Word
2000 or higher?

Article contributed by Bill Coan

The following code, pasted into the This Document module of a Word
2000 Template, will keep users out of the header and footer of
documents based on that template.

For Word 97, click here

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

 
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple users editing the same Word Document Vinod Ponoth Microsoft Word Help 1 June 12th 07 06:17 AM
Word 2003 - VB Code Does not work like it did in Word 2000 [email protected] Mailmerge 2 July 28th 06 07:01 PM
Prevent users from Printing a Word 2003 Document Cteckie Microsoft Word Help 7 July 25th 05 09:42 PM
how to prevent users from adding more pages to the document in MS. Pathfinder Microsoft Word Help 1 April 18th 05 01:30 PM
document locked for editing word 2000 cosmo Microsoft Word Help 1 February 14th 05 10:18 PM


All times are GMT +1. The time now is 03:53 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"