Inserting footnotes in a document protected for forms

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
 
C

Cindy Meister -WordMVP-

Hi Preeti,
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 might approach this differently, then.

Put this Section 7 text into a different document and protect THAT. use
Insert/Object to insert the section as a document *object* (NOT insert/File!).
The users could open the document containing section 7 by double-clicking, but
because it's protected, they can't change it.

In the meantime, your main document retains all of its functionality.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan 24 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
P

Preeti

Hi Cindy

Thanks for your help. I am working on a version of the template using the
Insert Object idea. So far so good. I never even thought of doing it this
way - it seems to be the right approach as my protected sections are a page
each in length.
A couple of questions have popped up that I hope you can help me with:

I need to create an If field which checks if a bookmark exists. If it does
then insert document object number 1, if it doesn't then insert document
object number 2. The bookmark NDAmarker is a position marker - it does not
contain any text. This is what I have so far:
{ IF {ref NDAmarker \* MERGEFORMAT } < 0 { EMBED Word.Document.8 \s } {
EMBED Word.Document.8 \s } }
Is this the best approach?

How do I distribute the template? Do I lock the links? If I lock the links
will the If field work? If I was sending a document generated via the
template to someone who did not use the templates would they still be able
to print/view the document? Are there any potential problems that I should
be aware of?

Many thanks

Preeti
 
C

Cindy Meister -WordMVP-

Hi Preeti,
I need to create an If field which checks if a bookmark exists. If it does
then insert document object number 1, if it doesn't then insert document
object number 2. The bookmark NDAmarker is a position marker - it does not
contain any text. This is what I have so far:
{ IF {ref NDAmarker \* MERGEFORMAT } < 0 { EMBED Word.Document.8 \s } {
EMBED Word.Document.8 \s } }
Is this the best approach?
Having an IF field check for the *existence* of a bookmark is tricky.
Because if you REF a bookmark that doesn't exist, what you'll actually get
is an error message. Try that, outside an if field :)

Now click in that and Ctrl+Shift+F9 to turn the field into plain text. Put
"quotes" around it. Press Ctrl+F9 to put it in field brackets and NOT create
your IF field, testing if the REF results in this error message.
How do I distribute the template? Do I lock the links? If I lock the links
will the If field work? If I was sending a document generated via the
template to someone who did not use the templates would they still be able
to print/view the document? Are there any potential problems that I should
be aware of?
By distribute, do you mean give to others to use for creating documents? Or
should people only be able to view a final result?

For that latter, I'd get rid of the fields and links (break them). Roughly,
Ctrl+A, Ctrl+Shift+F9 would do that. (This will also reduce file size and
make sure outsiders can't see your server/file system.)

If others need to use what's in the linked files, then they have to have
those files. Otherwise, yes, you'd have to lock (all) the fields, or break
the links.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan 24 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
P

Preeti

Hi Cindy

Once again many thanks for your help. I have reworked the IF field using
your advise:
{IF {ref NDAmarker} = "Error! Reference source not found."{ EMBED
Word.Document.8 \s } { EMBED Word.Document.8 \s }}.

Once again many thanks

Preeti
 

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