Automating Microsoft word with Python.Net

1.7k Views Asked by At

How to automate Microsoft office using office interop with python.net? I tried following but gives error:

import clr
clr.AddReference("System")
clr.AddReference("Microsoft.Office.Interop")

from Microsoft.Office.Interop import Word

wordApp = Word.Application()
wordApp.Visible = True
doc1 = wordApp.Documents.Add()

AttributeError: '__ComObject' object has no attribute 'Add'

1

There are 1 best solutions below

2
On BEST ANSWER

I wrote a simple wrapper that enables COM interop with pythonnet. Full details here:

https://github.com/pythonnet/pythonnet/issues/260