SHELL handling a switch.....

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jason

    #1

    SHELL handling a switch.....

    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.Va lue

    any help is appreciated

    --------------------------------------------------------------------------------------------------------------------------
    Private Sub VNC_Viewer_Clic k()
    On Error GoTo Err_VNC_Viewer_ Click

    Dim stAppName As String

    stAppName = "C:\Program Files\RealVNC\V NC4\vncviewer.e xe"
    Call Shell(stAppName , 1)

    Exit_VNC_Viewer _Click:
    Exit Sub

    Err_VNC_Viewer_ Click:
    MsgBox Err.Description
    Resume Exit_VNC_Viewer _Click

    End Sub

  • Terry Kreft

    #2
    Re: SHELL handling a switch.....

    either
    stAppName = """" & "C:\Program Files\Real\VNC4 \vncviewer.exe" & """" &
    computername.Va lue
    or
    stAppName = """C:\Progr am Files\Real\VNC4 \vncviewer.exe" "" &
    computername.Va lue

    call Shell(stappname )


    --
    Terry Kreft



    "Jason" <wills.jason@gm ail.com> wrote in message
    news:1133948898 .314168.290770@ o13g2000cwo.goo glegroups.com.. .[color=blue]
    >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.Va lue
    >
    > any help is appreciated
    >
    > --------------------------------------------------------------------------------------------------------------------------
    > Private Sub VNC_Viewer_Clic k()
    > On Error GoTo Err_VNC_Viewer_ Click
    >
    > Dim stAppName As String
    >
    > stAppName = "C:\Program Files\RealVNC\V NC4\vncviewer.e xe"
    > Call Shell(stAppName , 1)
    >
    > Exit_VNC_Viewer _Click:
    > Exit Sub
    >
    > Err_VNC_Viewer_ Click:
    > MsgBox Err.Description
    > Resume Exit_VNC_Viewer _Click
    >
    > End Sub
    >[/color]


    Comment

    • Jason

      #3
      Re: SHELL handling a switch.....

      Thanks very much for that - worked a treat.

      thanks for the help
      Jason

      Comment

      • Tom van Stiphout

        #4
        Re: SHELL handling a switch.....

        On Wed, 7 Dec 2005 11:07:13 -0000, "Terry Kreft"
        <terry.kreft@mp s.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
        <SomeComputerNa me>

        -Tom.

        [color=blue]
        >either
        >stAppName = """" & "C:\Program Files\Real\VNC4 \vncviewer.exe" & """" &
        >computername.V alue
        >or
        >stAppName = """C:\Progr am Files\Real\VNC4 \vncviewer.exe" "" &
        >computername.V alue
        >
        >call Shell(stappname )[/color]

        Comment

        Working...