excel client in python

Alex Martelli aleaxit at yahoo.com
Tue Dec 26 19:07:25 EST 2000


"Scott Hathaway" <slhath at home.com> wrote in message
news:ty926.92981$yR4.2557991 at news1.rdc1.tx.home.com...
> Hello,
>
> I have the following vba code from Excel that I want to convert to python
> code to manipulate excel from python.  Can anyone help me translate?

You seem to have failed to run makepy (since a 'COM object unknown' is
what Python is grumping about).  You can run makepy, e.g. from PythonWin's
tools menu; it's almost always a good idea (you can also make sure that
Python knows about your type libraries in other ways, but makepy is the
classic & generally simplest way).

Once you've done that, you can, among other things, use keyword
arguments, and also access the symbolic constants you may need --
they get automatically added as attributes of the object
    win32com.client.constants
so you can then use
win32com.client.constants.xlNormal if you wish (the *string*
'xlNormal' that you're trying to use now is surely wrong; xlNormal
is the symbolic name of a numeric constant -- you can use the
numeric value if you wish, but not a string in its stead).


Alex






More information about the Python-list mailing list