Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Document Protection in 2007 SP2 fails to unprotect, works in SP1

54 views
Skip to first unread message

Angus Fox

unread,
May 15, 2009, 6:16:14 AM5/15/09
to
Hi, I have a requirement to automate document protection and unprotection
and am facing some difficulty with the following reproducible problem with
SP2 of Office 2007. Any help appreciated.

Angus
---
Environment:

Windows XP Professional, Version 2002 SP3
Office Word 2007 (12.0.6425.1000) SP2 MSO
Case:

I have two macros as follows:

Sub Protect()
ActiveDocument.Protect Password:="1db67abf", NoReset:=False, Type:=
_
wdAllowOnlyReading, UseIRM:=False, EnforceStyleLock:=False
End Sub

Sub Unprotect()
ActiveDocument.Unprotect Password:="1db67abf"
End Sub

1. Create a new Word file with just the text "hello".

2. Run the Protect macro.

3. Save the file, e.g. "C:\WORD Document/docx".

4. Exit Word

5. Open the saved file "C:\WORD Document/docx".

6. Run the Unprotect macro.

I would expect the document to be editable. Instead, I get an alert
that the password is incorrect, Run time error 5485. If I try to
unprotect from the Restrict Formatting and Editing task pane I get the
same error.

Variations:

I originally found this in an application addin written using VSTO in
c#.

I have tested this on Vista Business - same behaviour.

I have tested this in Office SP1 - the document is unprotected as I
expected

If I protect and then unprotect using the Review ribbon and the same
password as the macro before step 2, the document is unprotected in
step 6 as I expected.

If I protect and then unprotect using the Review ribbon and a
different password to the macro before step 2, I get the 5485 error as
Before.

Dr. Eckehard Pfeifer

unread,
May 15, 2009, 9:36:26 AM5/15/09
to
Hi, I can reproduce this issue

Sub ProtectMe()
ActiveDocument.Protect Password:="anypwd", Type:= wdAllowOnlyReading
End Sub

Sub UnprotectMe()
ActiveDocument.Unprotect Password:="anypwd"
End Sub

in VBA. It works in the opened new document, but after saving, closing and
reopening there is the password error in manual handling and in VBA.

So we have to wait for MS answer?

--
MfG EP
Entwicklung - Beratung - Training (www.dr-e-pfeifer.net)
XL-Maxibuch (ISBN: 3-86645-231-4)
Microsoft Office 2007-Programmierung (ISBN 3-86645-415-5)

Angus F

unread,
May 18, 2009, 8:29:12 AM5/18/09
to
Since this is reproducible, would someone tell me how to file a defect ?

Angus (BizSpark and Empower customer)


On 15/05/2009 11:16, in article C632FF7E.C1EA%ang...@newsgroup.nospam,

Tony Jollans

unread,
May 18, 2009, 11:57:29 AM5/18/09
to
I have raised this with Microsoft. They promise a reply within five business
days so I should hear back by the end of the week (although I will be 'off
air' myself until next Monday).

--
Enjoy,
Tony

www.WordArticles.com

"Angus F" <ang...@newsgroup.nospam> wrote in message
news:C6371328.C374%ang...@newsgroup.nospam...

Tony Jollans

unread,
May 24, 2009, 8:54:08 PM5/24/09
to
I haven't actually received a reply from Microsoft but I have been told
there is a hotfix available that may fix this issue - it did for me,
although I have only done limited testing:
http://support.microsoft.com/kb/969961/en-us

--
Enjoy,
Tony

www.WordArticles.com

"Tony Jollans" <My forename at my surname dot com> wrote in message
news:OrMFCG91...@TK2MSFTNGP05.phx.gbl...

Dr. Eckehard Pfeifer

unread,
May 25, 2009, 9:40:12 AM5/25/09
to
Hi, Tony, thank you in this NG, too. It works fine.

Tony Jollans

unread,
May 25, 2009, 11:24:59 AM5/25/09
to
Good to hear. Thank you for confirming.

--
Enjoy,
Tony

www.WordArticles.com

"Dr. Eckehard Pfeifer" <e...@dr-e-pfeifer.newsgroup.net> wrote in message
news:%23tKXV5T...@TK2MSFTNGP06.phx.gbl...

Angus F

unread,
Jun 2, 2009, 7:32:55 AM6/2/09
to
The hotfix solved the issue for us. Thanks all

Angus


On 25/05/2009 01:54, in article #XO4eNN3...@TK2MSFTNGP02.phx.gbl, "Tony

Tony Jollans

unread,
Jun 2, 2009, 9:35:10 AM6/2/09
to
Angus,

Please be aware that there is a serious problem with the hotfix. It causes
destruction of Document Variables (at least in some circumstances) - in all
documents, not just forms.

There is no official word from Microsoft on any of this yet, which is a
little disappointing.

--
Enjoy,
Tony

www.WordArticles.com

"Angus F" <ang...@newsgroup.nospam> wrote in message

news:C64ACC77.C66D%ang...@newsgroup.nospam...

0 new messages