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.
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 (BizSpark and Empower customer)
On 15/05/2009 11:16, in article C632FF7E.C1EA%ang...@newsgroup.nospam,
--
Enjoy,
Tony
"Angus F" <ang...@newsgroup.nospam> wrote in message
news:C6371328.C374%ang...@newsgroup.nospam...
--
Enjoy,
Tony
"Tony Jollans" <My forename at my surname dot com> wrote in message
news:OrMFCG91...@TK2MSFTNGP05.phx.gbl...
--
Enjoy,
Tony
"Dr. Eckehard Pfeifer" <e...@dr-e-pfeifer.newsgroup.net> wrote in message
news:%23tKXV5T...@TK2MSFTNGP06.phx.gbl...
Angus
On 25/05/2009 01:54, in article #XO4eNN3...@TK2MSFTNGP02.phx.gbl, "Tony
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
"Angus F" <ang...@newsgroup.nospam> wrote in message
news:C64ACC77.C66D%ang...@newsgroup.nospam...