By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,521 Members | 1,228 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,521 IT Pros & Developers. It's quick & easy.

SHELL handling a switch.....

P: n/a
I have the following event proceedure on a command button - which works
great, however, i would like to add the value of another field onto the
end.

e.g i have a field with the computer name in, and i would like the
program to execute with the computer name on the end of the command,
but not sure how to go about this....
something like:
stAppName = "C:\Program Files\Real\VNC4\vncviewer.exe"
computername.Value

any help is appreciated

--------------------------------------------------------------------------------------------------------------------------
Private Sub VNC_Viewer_Click()
On Error GoTo Err_VNC_Viewer_Click

Dim stAppName As String

stAppName = "C:\Program Files\RealVNC\VNC4\vncviewer.exe"
Call Shell(stAppName, 1)

Exit_VNC_Viewer_Click:
Exit Sub

Err_VNC_Viewer_Click:
MsgBox Err.Description
Resume Exit_VNC_Viewer_Click

End Sub

Dec 7 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
either
stAppName = """" & "C:\Program Files\Real\VNC4\vncviewer.exe" & """" &
computername.Value
or
stAppName = """C:\Program Files\Real\VNC4\vncviewer.exe""" &
computername.Value

call Shell(stappname)
--
Terry Kreft

"Jason" <wi*********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I have the following event proceedure on a command button - which works
great, however, i would like to add the value of another field onto the
end.

e.g i have a field with the computer name in, and i would like the
program to execute with the computer name on the end of the command,
but not sure how to go about this....
something like:
stAppName = "C:\Program Files\Real\VNC4\vncviewer.exe"
computername.Value

any help is appreciated

--------------------------------------------------------------------------------------------------------------------------
Private Sub VNC_Viewer_Click()
On Error GoTo Err_VNC_Viewer_Click

Dim stAppName As String

stAppName = "C:\Program Files\RealVNC\VNC4\vncviewer.exe"
Call Shell(stAppName, 1)

Exit_VNC_Viewer_Click:
Exit Sub

Err_VNC_Viewer_Click:
MsgBox Err.Description
Resume Exit_VNC_Viewer_Click

End Sub

Dec 7 '05 #2

P: n/a
Thanks very much for that - worked a treat.

thanks for the help
Jason

Dec 7 '05 #3

P: n/a
On Wed, 7 Dec 2005 11:07:13 -0000, "Terry Kreft"
<te*********@mps.co.uk> wrote:

The reason Terry's code works is because you have to put double-quotes
around a path that includes funny characters or spaces.
If you had typed your original value in the Run box in Windows, it
wouldn't have worked either: Windows would have thought you wanted to
run a program called:
C:\Program
and pass it a couple of arguments like this:
Files\Real\VNC4\vncviewer.exe
and
<SomeComputerName>

-Tom.

either
stAppName = """" & "C:\Program Files\Real\VNC4\vncviewer.exe" & """" &
computername.Value
or
stAppName = """C:\Program Files\Real\VNC4\vncviewer.exe""" &
computername.Value

call Shell(stappname)


Dec 7 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.