Starting Excel from cmd pmpt, pass parameters

  • Thread starter Thread starter Jerry G. Slater
  • Start date Start date
J

Jerry G. Slater

Is it possible to start Excel from a command prompt and
pass it parameters like a DOS/C;Delphi;etc program and
pass it parameters?

I've tried executing it from a cmd prompt like:

C:\.....\excel.exe a b c d

and it thinks a b c d are files.

In mainframe terms, I want to start it like:

// EXEC PGM=EXCEL,PARM='02042004, FULL'

or in a C program be able to read

ArgC, and ArgV

or in Delphi be able to get

ParamCt, ParamStr(0..ParamCt)

I'm actually I'm going to do a create task API call to
start Excel with "ONE" file that has several macros and a
workbook_open() to run the stuff.

But I need to be able to grab a sequential file and read
it, but it will have an "unknown" name so I can't hard
code it and I DON'T want to open it in ANOTHER workbook....

got any clues anyone??

Thanks
JGS
 
Hi Jerry,

I have a system whereby I run dos batch jobs with lines like this

rem Start the program
"c:\program files\microsoft office\office\excel.exe" MyProgram.xls

where MyProgram.xls reads a initialization workbook (ini.xls) via
workbook_open() and then passes the read parameters onto the various macros
that are in MyProgram.xls

You could also have a c program that has argc, argv that writes into ini.xls
as a csv file which is then open by MyProgram.xls although I have not tried
that.

Regards, Milos.
 
Milos:

I figured I could do the same thing from the thread that
does the create task by first writing a file called
xyz.xls and then execute Excel like:

Excel xyz.xls reports.xls

then read the parameters out of the book1 workbook.

I consider that ARCHAIC (no offense intended) ... I should
be able to read parm1 parm2 parm3 REGARDLESS of the fact
that no one (MICROSOFT IN PARTICULAR) tells you how you
can execute Excel via a command prompt... There are
MILLIONS of program people like you and I have to convert,
and that old STANDARD has been summarily dropped,
by "good 'ol Bubbie Gates"....

Thanks for the idea, but I want it to work the way "It
Used To Work" .... the WHOLE WORLD USED TO WORK THAT WAY

.....and then they (MS) stepped in and took it away from
us....

They do not have that right....

Sadly, and with thanks,
JGS
 
Back
Top