win32com: How to use optional parameters?

someguy jdub at nospam.net
Tue Jul 11 15:40:56 EDT 2000


Sir,

why not hold the places like this:

xl.Worksheets.Add(NULL,NULL,NULL,aftervaluehere)

just as if you weren't using the "parametername=varnam" syntax, even VB
would default to the order the function expects the calls.

Another sure way to find out would be to generate the MIDL for the excel VBA
you are coding, then you could do the same thing in C/C++ COM which would
most certainly require the correct order of parameters and not named
parameters in any order.

-Jay R. Wren



"Ilja Heitlager" <news at heitlager.com> wrote in message
news:8kf3i4$1gu$1 at spectra.a2000.nl...
> There was a small error in my example:
> >
> >    xl.Worksheets.Add After:=xl.Worksheets.Count
> >
>
> should be in VB:
>
>      xl.Worksheets.Add After:=xl.Worksheets(xl.Worksheets.Count)
>
> So in Python it becomes:
>
>     xl.Worksheets.Add(After=xl.Worksheets(xl.Worksheets.Count))
>
> Which PythonCom sees as the first argument (the Before), argh.
>
> PS I am using Pythoncom  Version 1.5.2, build 129
>
> Please guys help me out, I hate to do all my work in VB (if possible ;-)
>
> Ilja
>
>







More information about the Python-list mailing list