Anubha
Anubha

Reputation: 1415

How to pass variable by the shell method in vb?

I saw this question related question

In this the string was "wibble", but what if my string is in a variable. Then how would I pass it. Example

 Dim lng As String

how do I pass lng as a command line to the exe application.

Upvotes: 0

Views: 4098

Answers (1)

anishsane
anishsane

Reputation: 20980

If you want to receive command line parameters:

command line passed to vn6 application is captured by a global string variable called "command"

NOTE: That variable will contain entire command line, not in array like in case of C. You would need to parse command variable explicitly.

e.g. somewhat like:

Dim lng As String
Dim lngValue As long
....
....
sub main
lng = command$
lngValue = val(lng)
....
....
end sub

If you want to send command line parameters:

you can simply do it using string concatenation:

Shell("""PathName.exe"" """ & lng & """ ""wibble 2""", vbNormalFocus)

Upvotes: 4

Related Questions