problem to unprotect a word document

Discussion in 'Python' started by Christian Lehmann, Nov 10, 2003.

  1. Hello,

    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
    protecttype = docfile.ProtectionType # anyway 2

    # do some work

    protecttype = docfile.ProtectionType # anyway 2

    So someone please tell me, whats my fault?

    best regards
    Christian Lehmann, Nov 10, 2003
    1. Advertisements

  2. Christian Lehmann

    Peter Hansen Guest

    Is it possible you should actually be *calling* Unprotect
    and Protect, instead of just retrieving their values?
    To do that, make sure you include the parentheses as in


    Python is not VB...

    Peter Hansen, Nov 10, 2003
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.