Hi folks,
Hope you can help me out here. I've got a protected document with certain sections unprotected to allow users to make changes. The problem I'm currently having is that even though they can edit the section text, they cannot use Bullets and Numbering/Bordering and Shading (to name a few) because they're greyed out on the Format menu.
I call a function to allow certain sections to remain editable (SetEditableDocSections doc, EDITABLE_SECTIONS)
and then do doc.Protect wdAllowOnlyFormFields, , PROTECT_PASSWORD
The code for SetEditableDocSections is below.
Function SetEditableDocSections(doc As Document, sSections As String)
Dim sTemp As String
Dim iSectionID As Integer
Dim s As Section
On Error Resume Next
'first, set all sections as protected
For Each s In doc.Sections
s.ProtectedForForms = True
Next
'then set those we want to be unprotected
sTemp = sSections
Do Until sTemp = ""
iSectionID = nnCInt(ParseStr(sTemp, ";"))
If iSectionID > 0 Then
doc.Sections(iSectionID).ProtectedForForms = False
End If
Loop
End Function
It's Word 2002 on XP, all help GREATLY appreciated.
Cheers,
Scott
Hope you can help me out here. I've got a protected document with certain sections unprotected to allow users to make changes. The problem I'm currently having is that even though they can edit the section text, they cannot use Bullets and Numbering/Bordering and Shading (to name a few) because they're greyed out on the Format menu.
I call a function to allow certain sections to remain editable (SetEditableDocSections doc, EDITABLE_SECTIONS)
and then do doc.Protect wdAllowOnlyFormFields, , PROTECT_PASSWORD
The code for SetEditableDocSections is below.
Function SetEditableDocSections(doc As Document, sSections As String)
Dim sTemp As String
Dim iSectionID As Integer
Dim s As Section
On Error Resume Next
'first, set all sections as protected
For Each s In doc.Sections
s.ProtectedForForms = True
Next
'then set those we want to be unprotected
sTemp = sSections
Do Until sTemp = ""
iSectionID = nnCInt(ParseStr(sTemp, ";"))
If iSectionID > 0 Then
doc.Sections(iSectionID).ProtectedForForms = False
End If
Loop
End Function
It's Word 2002 on XP, all help GREATLY appreciated.
Cheers,
Scott