problem to unprotect a word document

SBrunning at SBrunning at
Mon Nov 10 15:57:10 CET 2003

> From:	docelm at [SMTP:docelm at]
> I´m trying to unprotect a word document with python for reading all form
> fields.
> But it doesn´t work.
> Here´s a simple code sample:
>     wordapp   = win32com.client.Dispatch("Word.Application")
>     docfile   = wordapp.Documents.Open(file)
>     protecttype = docfile.ProtectionType    # protected delivers 2
>     docfile.Unprotect                       
>     protecttype = docfile.ProtectionType    # anyway 2
>     # do some work
>     docfile.Protect                      
>     protecttype = docfile.ProtectionType    # anyway 2
Just a wild guess - docfile.Unprotect looks like a it might well be a
function, but you aren't *calling* it. Try using "docfile.Unprotect()"

Simon Brunning,

The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
accept liability for statements made which are clearly the senders own.

More information about the Python-list mailing list