windll/win32client question

Alex Rice alex at integretechpub.com
Mon Sep 10 14:44:38 EDT 2001


I've been using the win32client module writing a python app which
converts MSWord content to LaTeX and XML. It's great so far! Even bought
the Pythin Win32 Programming book! However, I've run into a snag & need
some advice:

I need to access functions that exist in an addin for MSWord. I can't
figure out how to get to the functions from Python. The addin consists
of a .dll, a .wll and some .dot files. The .dot files are the VBA
macros, and the .wll is a "Word Add-In .dll".

I tried using python's calldll/windll to access the functions in the
.dll. However, the "preferred entry point" for this SDK is the .wll
file. Furthermore the .wll defines extra functions which I need which
are not defined in the .dll. The .dot files AFAIK are just VBA wrappers
for the .dll and .wll functions. So I need to access the .wll.

Alghough windll.module() can access the .dll, it can't access the .wll
So apparently the .wll is not registered like a normal .dll.
Incidentally, the .wll lives in the MSWord startup folder (Program
Files\Microsoft Office\Startup). Is there a way to get windll to see
that file?

So, I thought if I can't call it directly, I'll to go through Word's COM
interface, not knowing even if the interface is exposed there. I got
only as far as this:

>>> import win32com.client
>>> wordApp = win32com.client.Dispatch("Word.Application")
>>> addIn = wordApp.AddIns('MathType Commands 5 for Word')
>>> addIn
<win32com.gen_py.Microsoft Word 9.0 Object Library.AddIn>
>>> dir(addIn)
['_oleobj_']
>>> addIn.FormatEquations
...
AttributeError: FormatEquations

FormatEquations() should be defined according to the VBA interface. I
read this as that the AddIn does not expose a COM interface which can be
used from Python. Is that correct?

Any suggesions would be greatly appreciated. I'm not much of a win32
programmer- but know enough that I want to stay in python land and not
rewrite this in VB!

TIA


Alex Rice
alex at integretechpub.com



More information about the Python-list mailing list