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
(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