trouble with document protection in Word 2003

G

Gordon Filby

Hi,

I've been using the code below for a couple of years without any problems.
That is, until today when I needed to use it with Word 2003. As you see it
makes a new document based on ImprvdG8terBogen.dot. This is a document
consisting of a freely editable upper part (where I want to dump the BWPNr
at corresponding bookmarks etc) and a lower part consisting of formfields to
be filled out by my users. This lower part is protected so that the user can
only jump from field to field.

Running it in Word 2003 causes it to crash at the line ''BkMrk.Text = " " &
PubBWPNr with the message that I'm not allowed to edit there because
document protection is in effect.

If I move to the produced document I can edit it by hand, so what is going
on?


Be grateful for any tips.

Regards,

Gordon Filby
Documents.Add _
Template:= _
"C:\Documents and Settings\Administrator\Application
Data\Microsoft\Templates\ImprvdG8terBogen.dot", NewTemplate:=False

Set BkMrk = ActiveDocument.GoTo(wdGoToBookmark, , , "BWPNr")
''BkMrk.Text = " " & PubBWPNr
BkMrk.Text = PubBWPNr
Set BkMrk = ActiveDocument.GoTo(wdGoToBookmark, , , "VorhabenTitel")
BkMrk.Text = " " & VorhabenTitel
Set BkMrk = ActiveDocument.GoTo(wdGoToBookmark, , , "Antragsteller")
BkMrk.Text = " " & strAT
 
D

DA

Hi Gordon

The protection method applies to the document object, so
I'm confused as to what you mean by a freely editable
upper part and protected lower part. Are you setting
comment protection with user exceptions ?

If you're setting form protection your exceptions are
going to be ignored and you'll get the error.

Check your "ActiveDocument.ProtectionType" to ensure
you've got "wdAllowOnlyComments" protection set. I think
this is the only way you can add your text with the
protection turned on. Prior to this you'll also have to
select the region of text where your bookmark resides and
use something like
"Selection.Editors.Add wdEditorEveryone"

Failing that, and if document security isn't crucial,
then I'd suggest you turn off protection before inserting
your text and then re-enabling it.

Good luck,
Dennis
-----Original Message-----
Hi,

I've been using the code below for a couple of years without any problems.
That is, until today when I needed to use it with Word 2003. As you see it
makes a new document based on ImprvdG8terBogen.dot. This is a document
consisting of a freely editable upper part (where I want to dump the BWPNr
at corresponding bookmarks etc) and a lower part consisting of formfields to
be filled out by my users. This lower part is protected so that the user can
only jump from field to field.

Running it in Word 2003 causes it to crash at the line ''BkMrk.Text = " " &
PubBWPNr with the message that I'm not allowed to edit there because
document protection is in effect.

If I move to the produced document I can edit it by hand, so what is going
on?


Be grateful for any tips.

Regards,

Gordon Filby
Documents.Add _
Template:= _
"C:\Documents and Settings\Administrator\Application
Data\Microsoft\Templates\ImprvdG8terBogen.dot", NewTemplate:=False

Set BkMrk = ActiveDocument.GoTo (wdGoToBookmark, , , "BWPNr")
''BkMrk.Text = " " & PubBWPNr
BkMrk.Text = PubBWPNr
Set BkMrk = ActiveDocument.GoTo
(wdGoToBookmark, , , "VorhabenTitel")
BkMrk.Text = " " & VorhabenTitel
Set BkMrk = ActiveDocument.GoTo
(wdGoToBookmark, , , "Antragsteller")
 

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