P
Preeti
Hi
Help!! I can't figure this one out. I'm using Word 2000 and have created a
template. The template has 7 sections and needs to be protected for forms as
section 7 has legal text which users are not allowed to alter. I am aware
that by adding protection to the template that there is a loss of
functionality. One of the features I would like to get to work is Insert
footnotes. This is what I've tried so far:
Sub Insert_Footnote()
UnLockDoc
ActiveDocument.Footnotes.add Range:=Selection.Range, Reference:=""
'''I tried the following but it didn't work either
'If Dialogs(wdDialogInsertFootnote).Show = 0 Then
'MsgBox "Footnote cancelled."
'LockDoc
'End If
LockDoc
End Sub
Sub UnLockDoc()
Set adoc = ActiveDocument
'Unprotect
If adoc.ProtectionType <> wdNoProtection Then
adoc.Unprotect , Password:="humpty"
End If
End Sub
Sub LockDoc()
Dim LockRange
Dim oSection
Set adoc = ActiveDocument
On Error Resume Next
'unprotect first
If adoc.ProtectionType <> wdNoProtection Then
adoc.Unprotect , Password:="humpty"
End If
'check each section is unprotected for forms
For Each oSection In adoc.Sections
oSection.ProtectedForForms = False
Next
Set oSection = Nothing
If ActiveDocument.Bookmarks.Exists("STCmarker") = True Then
ActiveDocument.Range(adoc.Bookmarks("STCmarker").Range.Start,
adoc.Bookmarks("STCmarker").Range.End).Sections(1).ProtectedForForms = True
End If
If ActiveDocument.Bookmarks.Exists("NDAmarker") = True Then
ActiveDocument.Range(adoc.Bookmarks("NDAmarker").Range.Start,
adoc.Bookmarks("NDAmarker").Range.End).Sections(1).ProtectedForForms = True
End If
If ActiveDocument.Bookmarks.Exists("STCmarker") = True Or
ActiveDocument.Bookmarks.Exists("NDAmarker") = True Then _
adoc.Protect Password:="humpty", NoReset:=False, Type:=wdAllowOnlyFormFields
End Sub
I used similar code to get Insert Cross References and it worked:
Sub Insert_CrossReference()
UnLockDoc
If Dialogs(wdDialogInsertCrossReference).Show = 0 Then
MsgBox "Cross-reference cancelled."
LockDoc
End If
LockDoc
End Sub
If anyone can point me in the right direction, I would really appreciate it.
Thanks
Preeti
Help!! I can't figure this one out. I'm using Word 2000 and have created a
template. The template has 7 sections and needs to be protected for forms as
section 7 has legal text which users are not allowed to alter. I am aware
that by adding protection to the template that there is a loss of
functionality. One of the features I would like to get to work is Insert
footnotes. This is what I've tried so far:
Sub Insert_Footnote()
UnLockDoc
ActiveDocument.Footnotes.add Range:=Selection.Range, Reference:=""
'''I tried the following but it didn't work either
'If Dialogs(wdDialogInsertFootnote).Show = 0 Then
'MsgBox "Footnote cancelled."
'LockDoc
'End If
LockDoc
End Sub
Sub UnLockDoc()
Set adoc = ActiveDocument
'Unprotect
If adoc.ProtectionType <> wdNoProtection Then
adoc.Unprotect , Password:="humpty"
End If
End Sub
Sub LockDoc()
Dim LockRange
Dim oSection
Set adoc = ActiveDocument
On Error Resume Next
'unprotect first
If adoc.ProtectionType <> wdNoProtection Then
adoc.Unprotect , Password:="humpty"
End If
'check each section is unprotected for forms
For Each oSection In adoc.Sections
oSection.ProtectedForForms = False
Next
Set oSection = Nothing
If ActiveDocument.Bookmarks.Exists("STCmarker") = True Then
ActiveDocument.Range(adoc.Bookmarks("STCmarker").Range.Start,
adoc.Bookmarks("STCmarker").Range.End).Sections(1).ProtectedForForms = True
End If
If ActiveDocument.Bookmarks.Exists("NDAmarker") = True Then
ActiveDocument.Range(adoc.Bookmarks("NDAmarker").Range.Start,
adoc.Bookmarks("NDAmarker").Range.End).Sections(1).ProtectedForForms = True
End If
If ActiveDocument.Bookmarks.Exists("STCmarker") = True Or
ActiveDocument.Bookmarks.Exists("NDAmarker") = True Then _
adoc.Protect Password:="humpty", NoReset:=False, Type:=wdAllowOnlyFormFields
End Sub
I used similar code to get Insert Cross References and it worked:
Sub Insert_CrossReference()
UnLockDoc
If Dialogs(wdDialogInsertCrossReference).Show = 0 Then
MsgBox "Cross-reference cancelled."
LockDoc
End If
LockDoc
End Sub
If anyone can point me in the right direction, I would really appreciate it.
Thanks
Preeti