Protecting only certain pages upon opening

J

JuanManuel

Hi,
I have this long template which I am protecting by code upon opening. Now,
I'd only like to protect from page 2 onwards (leaving page 1 unprotected).
How can I do this with code?

Thank you
Juan
 
G

Graham Mayor

Why do you need to do this in code for a template? Simply insert a section
break at the end of page 1 and protect the document from section 2 onwards.
However with code

Dim i As Long
Dim Count As Integer
With ActiveDocument
Count = .Sections.Count
.Protect _
Type:=wdAllowOnlyFormFields, _
NoReset:=True, _
Password:=""
.Sections(1).ProtectedForForms = False
For i = 2 To Count
.Sections(i).ProtectedForForms = True
Next
End With

should work

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top