--- In [email protected], "entropyreduction" 
<alancampbelllists+ya...@...> wrote:
> 
> --- In [email protected], "Sheri" <sherip99@> wrote:
> 
> > Play with Excel.Application's GetSaveAsFileName. All the
> > arguments are Variants. The method's objective is to show the
> > file-save dialog and return a file name (or zero if canceled),
> > not to do an actual file save.
> > 
> > I'm still running with comPlugin0.72_091218_no_guesses
>  
> > This works:
> > local saf=appRef.method_typed("GetSaveAsFileName", "s s u s ", ;;+
> > "TestVariants.xls", "Excel Files (*.xls),*.xls", 1, "Hello")
> > 
> > Even using method_typed, there is currently no type setting
> > available that would allow you to skip an optional argument.
> 
> That's easy, I can add a k for skip option
> Of course you can only skip trailing args, so k would only be
> valid at end of type spec.

No, that's not what I meant. I was suggesting a spec for VT_EMPTY and one for 
VT_NULL. Most of the items id'ed as VARIANT seem to be that way only because 
they are optional. E.g., if you leave out the filetype string in 
GetSaveAsFileName the method should default it to *.*. If omitting only from 
the end, no need to specify. Even without method_typed, if we put "", maybe it 
should mean VT_EMPTY (if the typespec is a "VARIANT").

> 
> 
> > Would like to come up with some procedure that would allow typing of 
> > Variant arguments for use in normal method instead of method_typed.
> 
> That would be nice.
> 
> > How about:
> > com.setargtypes="s s u s "
> > ExcelApp.GetSaveAsFileName("TestVariants.xls", "Excel Files (*.xls),*.xls", 
> > 1, "Hello")
> > com.clearargtypes
> 
> Ugly but possible.  Just playing around with idea, how about
> com.setargtypes only applies to next call to a method/get/put, then 
> autmatically clears.  
> 
> Oh, of course it would have to be com.setargtypes("s s u s ")
> 
> Couls also have
> 
> com.setargtypes("s s u s stick")

That looks odd.

> 
> if you wanted it to not auto-reset.

The autoreset idea sounds good. If not much overhead, can just keep calling it, 
if method is being used in a loop.

> 
> > Would also want com.getargtypes
> 
> Sigh.

If always auto-reset, wouldn't need a a getter.

>  
> > (but still need a way to spec optional argument to be skipped, e.g., how to 
> > skip the two arguments before "Hello"?)
> 
> You can never skip anything but trailing args.
> 
> Unless you use named, instead of positional arguments
> (extensively used and documated in VBA).

In VB you just include the comma where an empty argument belongs.

>   
> > Currently this gets a com exception error:
> > ExcelApp.GetSaveAsFileName("TestVariants.xls", "Excel Files (*.xls),*.xls", 
> > 1, "Hello")
>  
> > I was planning to try having all digits in the last argument to
> > see if that generated an error similar to the one I've been
> > seeing, but no need (since it bombs even given unambiguous data)
> > 
> > This:
> > ExcelApp.GetSaveAsFileName("TestVariants.xls")
> > 
> > currently shows the save-as dialog but shows double quotes around
> > the proposed file name.
> 
> Odd.  Okay, will play when I get home
>

I tried above with version that preceded no_guesses. Same results as above.

Regards,
Sheri

Reply via email to