How to dismiss a dialog box displayed by MS Word when openning document in Python/Win32
Question: I'm trying to write a script that would go though content of all ms word docs
in a folder and collect some information. I use Python 2.7.3 and Ms Office
2007 The issue I have is that sometimes MS Word is coming with a warning/error
popup window when opening a document. An example of the error message is
'Microsoft Visual Basic: Sub or Function not defined'. Another error is that
too many grammar mistakes in the doc. These events suspend the processing
until you manually press OK button. After that the scrip continues processing
the document. An interesting note is that when I open the document manually in
word it doesn't produce the 'Sub or Function not defined' error.

So, is there a way to suppress these errors/warnings so that the script could
process the files in a batch mode?

Here is the code I use to open the word files:

    
    
    import win32com.client
    word = win32com.client.Dispatch("Word.Application")
    word.Visible = False
    ...
    doc = word.Documents.OpenNoRepairDialog(fname, False, True) # Popup window appears on this line
    


Answer: The `OpenNoRepairDialog` method does not appear to have any error suppression
options, as per;

<http://msdn.microsoft.com/en-us/library/office/ee426710(v=office.12).aspx>

It's possible you could disable these errors within Word preference somewhere.

Alternatively, try using `pywin32`?

<http://www.galalaly.me/index.php/2011/09/use-python-to-parse-microsoft-word-
documents-using-pywin32-library/>

These might also be relevant;

[Reading/Writing MS Word files in
Python](http://stackoverflow.com/questions/188444/reading-writing-ms-word-
files-in-python)

<https://github.com/mikemaccana/python-docx>

