win32com and Excel

dsavitsk dsavitsk at e-coli.net
Sun Jun 4 04:50:05 EDT 2000


"Matthew Miller" <matthewm at zebrasoft.co.nz> wrote in message
news:3939D364.2EF22B13 at zebrasoft.co.nz...
> hi everyone,
>
> A couple o0f questions:-
> 1)
> can you access an excel (.xls) file via com without having excel loaded
> on that machine?

to the best of my knowledge, so long as you have the odbc 'stuff' installed
you can do it.  is there a reason for excel if you don't have it? it might
be easier to use access. the 'stuff' (for the jet engine anyway) is freely
downloadable from microsoft. please excuse me if i'm totally wrong here.  i
am imagining an excel file that might as well be a db table.  if this is not
what you are doing then i don't know anything about excel.  it would be very
un-microsoft like to share much of the excel object model with folks who
don't own it.
i know from distributing programs with ie embeded in them that if the user
does not have up to date ie that things fail.
in summery, in order to have the object model on your computer you must have
installed it at some point, that is, win95 doesn't magically have excel
2000's COM installed.  accessing via odbc will work, but com needs a backend
sorry this isn't really that helpful

> 2)
> once you've done:-
>  blah = win32com.client.Dispatch("Excel.Application")
> can anyone give details of
> a) howto open a particular s/s in the current directory
> and
> b) howto access particular cells in that particular s/s
> and
> c) howto close that s/s

none of this seems all that python specific. i would pick up some book on
com programming and translate from there. for instance...
    rs.AddNew
        rs![FieldName] = x
    rs.Update
in vb translates to
    rs.AddNew()
    rs.Fields('FieldName').Value = x
    rs.Update()
in python





More information about the Python-list mailing list