--- In [email protected], "Sheri" <sheri...@...> 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.


> 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")

if you wanted it to not auto-reset.

> Would also want com.getargtypes

Sigh.
 
> (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).
  
> 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
 


Reply via email to