Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dq dq is offline
external usenet poster
 
Posts: 46
Default Reading command line parameters in a VBA program

Hallo everybody,

I have an Excel VBA macro that I run several times per day to generate
certain reports. To have this done fully automatic I need to be able
to launch the program with a commandline that looks like
....\ReportGenerator.xls /List=1000 /Date=Today
How can I read the parameter(s) '/List=1000 /Date=Today' in my
program. I find no property that returns this string.

Thanks to anybody who can help me because I've been looking for a
solution for quite some time now.

DQ

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Reading command line parameters in a VBA program

You can't pass parameters to Excel VBA macros from the command line,
unfortunately. Have you tried putting the parameters in a simple text
file -- or the Windows Registry -- and having your VBA macro read them
from there?

/ Tyla /

On Apr 17, 8:02 am, dq wrote:
Hallo everybody,

I have an Excel VBA macro that I run several times per day to generate
certain reports. To have this done fully automatic I need to be able
to launch the program with a commandline that looks like
...\ReportGenerator.xls /List=1000 /Date=Today
How can I read the parameter(s) '/List=1000 /Date=Today' in my
program. I find no property that returns this string.

Thanks to anybody who can help me because I've been looking for a
solution for quite some time now.

DQ



  #3   Report Post  
Posted to microsoft.public.excel.programming
dq dq is offline
external usenet poster
 
Posts: 46
Default Reading command line parameters in a VBA program

On 17 apr, 17:32, Tyla wrote:
You can't pass parameters to Excel VBA macros from the command line,
unfortunately. Have you tried putting the parameters in a simple text
file -- or the Windows Registry -- and having your VBA macro read them
from there?

/ Tyla /

On Apr 17, 8:02 am, dq wrote:



Hallo everybody,


I have an Excel VBA macro that I run several times per day to generate
certain reports. To have this done fully automatic I need to be able
to launch the program with a commandline that looks like
...\ReportGenerator.xls /List=1000 /Date=Today
How can I read the parameter(s) '/List=1000 /Date=Today' in my
program. I find no property that returns this string.


Thanks to anybody who can help me because I've been looking for a
solution for quite some time now.


DQ- Tekst uit oorspronkelijk bericht niet weergeven -


- Tekst uit oorspronkelijk bericht weergeven -


Hallo Tyla,

That is exactly what I do know: a batch file generates a .reg and
loads it into the registry and then launches the Excel program which
reads it back. But this is such a messy way that I was hoping there
was something in VBA itself.

Thanks anyway.

DQ

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Reading command line parameters in a VBA program

Bummer, isn't it? Next time I have Bill G. over to lunch, I'll talk to
him about this issue -- one a many I have on my list for him.

/ T /

On Apr 17, 8:40 am, dq wrote:
On 17 apr, wrote:



You can't pass parameters toExcelVBA macros from the command line,
unfortunately. Have you tried putting the parameters in a simple text
file -- or the Windows Registry -- and having your VBA macro read them
from there?


/Tyla/


On Apr 17, 8:02 am, dq wrote:


Hallo everybody,


I have anExcelVBA macro that I run several times per day to generate
certain reports. To have this done fully automatic I need to be able
to launch the program with a commandline that looks like
...\ReportGenerator.xls /List=1000 /Date=Today
How can I read the parameter(s) '/List=1000 /Date=Today' in my
program. I find no property that returns this string.


Thanks to anybody who can help me because I've been looking for a
solution for quite some time now.


DQ- Tekst uit oorspronkelijk bericht niet weergeven -


- Tekst uit oorspronkelijk bericht weergeven -


HalloTyla,

That is exactly what I do know: a batch file generates a .reg and
loads it into the registry and then launches theExcelprogram which
reads it back. But this is such a messy way that I was hoping there
was something in VBA itself.

Thanks anyway.

DQ



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Reading command line parameters in a VBA program

You cannot pass command line arguments to a workbook, but you can pass them
to Excel and grab them in an Auto_Open routine:
http://www.dailydoseofexcel.com/arch...uments-in-vba/

Called from Run with something like:
excel c:\book1.xls /e/some/args

I assume would work with ShellExcecute or from a Short Cut.

Having said that, there may be better ways of achieving your goal, possibly
with Automation/VBScript.

NickHK

"dq" wrote in message
oups.com...
On 17 apr, 17:32, Tyla wrote:
You can't pass parameters to Excel VBA macros from the command line,
unfortunately. Have you tried putting the parameters in a simple text
file -- or the Windows Registry -- and having your VBA macro read them
from there?

/ Tyla /

On Apr 17, 8:02 am, dq wrote:



Hallo everybody,


I have an Excel VBA macro that I run several times per day to generate
certain reports. To have this done fully automatic I need to be able
to launch the program with a commandline that looks like
...\ReportGenerator.xls /List=1000 /Date=Today
How can I read the parameter(s) '/List=1000 /Date=Today' in my
program. I find no property that returns this string.


Thanks to anybody who can help me because I've been looking for a
solution for quite some time now.


DQ- Tekst uit oorspronkelijk bericht niet weergeven -


- Tekst uit oorspronkelijk bericht weergeven -


Hallo Tyla,

That is exactly what I do know: a batch file generates a .reg and
loads it into the registry and then launches the Excel program which
reads it back. But this is such a messy way that I was hoping there
was something in VBA itself.

Thanks anyway.

DQ



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Are there command line parameters for Excel? Michael Excel Discussion (Misc queries) 9 August 5th 07 06:29 PM
Complete list of Excel Command line switches/parameters NHRunner[_2_] Excel Programming 1 July 11th 06 05:22 AM
Command line parameters to Excel Tom Walker Excel Programming 3 May 23rd 04 06:08 AM
passing parameters from command line Albrecht Hesmert Excel Programming 5 February 11th 04 03:20 PM
Command line parameters into a macro Donemowe Excel Programming 3 August 6th 03 09:12 AM


All times are GMT +1. The time now is 02:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"