AKM AKM - 3 years ago 121
Python Question

Opening word document with read mode using python

I have a python applicaiton that need to luanch a word document .
is there any option to luanch a word document with read mode only from python ?

Answer Source

You will find some very useful samples on the following page:

Python for Windows: Microsoft Office

Opening a Word document read-only can be achieved like this, False as the third parameter to Application.Documents.Open tells Word to open the document read-only.

import win32com.client, pythoncom, time

def word(wordfile):
    myWord = win32com.client.DispatchEx('Word.Application')
    myDoc = myWord.Documents.Open(wordfile, False, False, False)


    del myDoc
    del myWord
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download