Word 2007 SP2 protection issue for RTF format using Word object model

D

danboanta

Microsoft Word 2007 SP2 has a problem when a RTF document is protected
(AllowOnlyFormFields) with password using Word object model. When I
trying to protect a RTF document and unprotect with the same password =>
an error message that say the incorrect password is displayed. This
problem appears only using Word 2007 SP2, and works ok with previous
Word versions (2003, 2007 SP1…).
The vbs script below illustrates the problem:


Code:
--------------------

'Start Word
Dim oWordApp
Set oWordApp = CreateObject("Word.Application")
oWordApp.Visible = True

'Create a new document
Dim oNewDoc
Set oNewDoc = oWordApp.Documents.Add

'Protect document with wdAllowOnlyFormFields
oNewDoc.Protect 2, True, "Test"

'Save the document on disk as RTF (6 = wdFormatRTF)
oNewDoc.SaveAs "c:\test.rtf", 6
'Close the document
oNewDoc.Close

'Open saved document
Set oNewDoc = oWordApp.Documents.Open("c:\test.rtf")

'Try to unprotect => error message is displayed
oNewDoc.Unprotect "Test"

'Close the document
oNewDoc.Close False
oWordApp.Quit

--------------------


It is a known issue of Word 2007 SP2? Is there a Word 2007 hot-fix to
solve this issue?

Thanks
 
M

Maleks

danboanta said:
Microsoft Word 2007 SP2 has a problem when a RTF document is protected
(AllowOnlyFormFields) with password using Word object model. When I
trying to protect a RTF document and unprotect with the same password =>
an error message that say the incorrect password is displayed. This
problem appears only using Word 2007 SP2, and works ok with previous
Word versions (2003, 2007 SP1…).
(...)

It is a known issue of Word 2007 SP2? Is there a Word 2007 hot-fix to
solve this issue?

Thanks

I'm using MS Office 2007 with SP2. Yesterday I found the same problem - when
I protect Word document (.docx) with simple macro (just recorded protection
with certain password) once the file is closed and opened again I can't
remove the protection - neither with macro or with typing - message with
incorrect password is displayed every time.

Same as danboanta I wonder if there is a way to fix it (other than
unistalling SP2)? Also - how can I edit my docs which I currently can't
unprotect in any way?

Thanks in advance.

Maleks
 
M

Maleks

Hello Dan,

Thanks a lot for the link. It seems hot-fix is working, althought I
experienced one strange thing right after installing it.

I tried my macro with "test" password. It worked well when tried to
unprotected closed before file. When changed pass for the right one in VBA
code in both macros - protecting and unprotecting - I couldn't unprotect the
file. It turned out that somehow "test" password was the one to unprotect it.
Anyway after when I protected the file by hand it started to work ok.

I checked also files that I couldn't edit before installing hot-fix - I can
unprotect them again :)

Small thing but gives a relief.

BTW I tried to follow second link to see that conversation about the
problem, but all I could see was "You are not authorized to perform this
action.". It's not that important, but do you know if I an access it somehow?

Best regards,

Maleks
 

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