Rich,

Upon closer inspection, although my tracing made it appear to be an
error from Command(), it was a reference a couple of lines down to a
subscripted  variable. (Monday morning blues cloudin' my mind.)

HOWEVER!
I am glad I asked because now I know about Split, so all is not lost
(well, maybe a little of your time, and I apologize for that). I must
admit that it is pretty slick using Split and Ubound. I have re-coded my
function that gathers args to use them, and it is much better than the
clunker I, er, 'borrowed' from MS.

Man, I tell you, I looked high and low for someway to dupe that
argc/argv, but never in a million years would I have thought they would
be called Split and Ubound.

I sure hope someone else on Talk can profit from this too. As for me,
among other things, I am using the argument to keep from putting the BWS
icon on the taskbar and to 'exit' instead of 'file' in Meditech when I
am testing. Saves me from having to comment out code. I just add or
delete the argument in the Boot Manager, and make sure I start from Boot
Manager. I could just as well create shortcut icons, one with "/c test",
the other without, and use them to start BWS.

Anyway, TKs again,

Lew Hundley
Information Specialist - Programmer
Silverton Hospital
Silverton Oregon
503.873.1657
[EMAIL PROTECTED]



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rich McNeil
Sent: Monday, July 28, 2003 12:44 PM
To: [EMAIL PROTECTED]
Subject: RE: [Talk] Help with Command() in VBA

Lew,

I haven't been able to reproduce an error in the VBA Command parameter,
but you can find the number of parameters in Command with:

        Dim S
        S = Split(Command, " ")
        S(0) has the first parameter, etc.
        Ubound(S) + 1 is the number of parameters

Rich McNeil
Boston Software Systems
866 653 5105
www.bostonworkstation.com
 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Monday, July 28, 2003 3:24 PM
To: BostonWorkStation Talk
Subject: [Talk] Help with Command() in VBA

(Win2000, BWS 6.5 rev 118, VBA, working with Meditech Magic 4.9,
Meditech NUI Workstation and HSS WinStrat ver 0304 applications)

I want to pass a command line argument when I call my script from Boot
Manager.  I am using VBA, and the only function I have found to use is
Command().

However, I do not want to require the argument(s). That is, I would like
to allow the script to be called, but not include the "/c" switch.

Unfortunately, if there is no argument passed to VBA, Command() throws
an error. 

What I would like to do is get a count of the number of arguments that
are passed, and, if there are none, default some values, and go on with
the script.

I know how to do this in C with argc and argv, but I have not succeeded
in figuring out what to do in VBA. Perhaps use the error trap, but then
I would not know when I get a legit error or not.

Any suggestions?

TKs

Lew Hundley
Information Specialist - Programmer
Silverton Hospital
Silverton Oregon
503.873.1657
[EMAIL PROTECTED]




Reply via email to