[AccessD] Automate Excel macro with parameters

jwcolby jwcolby at colbyconsulting.com
Fri Feb 27 11:35:53 CST 2009


Shamil,

Thanks for the response.  The parameters in a text file sounds almost as ugly as case statement.

My Excel class is expecting to be able to do things with an Excel application, open a worksheet, 
poke values out to cells and so forth.  That syntax I quoted appears to pick up the existing and 
already open Excel application instance, it is not opening a new Excel application (AFAICT).

In my own code if I need to process a param array passed in I can do that but in this case it is a 
method of a class in Excel and that method simply doesn't know what to do with an array passed in. 
The case sounds like the answer.

I hate ugly almost as much as I hate punting.

John W. Colby
www.ColbyConsulting.com


Salakhetdinov Shamil wrote:
> Hi John,
> 
> Why not:
> 
> 1. a) Write parameterrs into a simple text file with each parameters on a separate line in MS Access VBA...
>    b) Read parameters from text file in MS Excel VBA(?) macro?
> 
>    If you run many instances of MS Excel then you can make different text files with parameters for different instances, and pass the name/fullpath of this file as the only parameter in your xlBook.Application.Run call
> 
> OR
> 
> 2. Start MS Excel instance using Shell(...) and command line then you can pass as many custom params as you wish I suppose (needs checking)
> 
> BTW, for the case when ParamArray should be passed through as another ParamArray I always used static Select Case as in your below sample - and I had I believe up to 30 params to pass this way - never had any issues with that - that coding style is looking ugly - yes - but it works well :)
> 
> Thank you.
> 
> --
> Shamil




More information about the AccessD mailing list