ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Some macro help with shelling out to other program (https://www.excelbanter.com/excel-discussion-misc-queries/14399-some-macro-help-shelling-out-other-program.html)

Alan

Some macro help with shelling out to other program
 
We are using VNC in house to do remote control between workstations.
As there are over 25 of them, I would like to set up a little macro in
Excel (2003) that when run, displays a list of user names along with a
box prompting for which # on the list you want to connect to.

Here's what I have so far:
----
Sub RunVNC()

Shell ("c:\program files\hyena\vncviewer.exe sv-ws6")

End Sub
----
I would like to see something like:
1. Payroll
2. Receivables
3. Accountant
4. Reception
Please enter the number to connect to:

Typing 1 and pressing ENTER would run the Shell command above.

Can anyone help??

TIA, Alan

Dave Peterson

When your list gets a little longer, you may want to consider creating your own
userform.

But with just 4, this seems to work ok for me:

Option Explicit
Sub RunVNC()
MsgBox 1
'Shell ("c:\program files\hyena\vncviewer.exe sv-ws6")
End Sub
Sub Run2()
MsgBox 2
End Sub
Sub Run3()
MsgBox 3
End Sub
Sub Run4()
MsgBox 4
End Sub
Sub Menu()
Dim resp As Variant
Dim maxOptions As Long

maxOptions = 4

resp = Application.InputBox _
(Prompt:="1. Payroll" & vbLf & _
"2. Receivables" & vbLf & _
"3. Accountant" & vbLf & _
"4. Reception" & vbLf & _
vbLf & "Please type a number and hit enter", Type:=1)

If resp = False Then
Exit Sub
End If

If CLng(resp) < 1 _
Or CLng(resp) maxOptions Then
MsgBox "Come back later!"
Exit Sub
End If

Select Case CLng(resp)
Case Is = 1: Call RunVNC
Case Is = 2: Call Run2
Case Is = 3: Call Run3
Case Is = 4: Call Run4
End Select

End Sub


Alan wrote:

We are using VNC in house to do remote control between workstations.
As there are over 25 of them, I would like to set up a little macro in
Excel (2003) that when run, displays a list of user names along with a
box prompting for which # on the list you want to connect to.

Here's what I have so far:
----
Sub RunVNC()

Shell ("c:\program files\hyena\vncviewer.exe sv-ws6")

End Sub
----
I would like to see something like:
1. Payroll
2. Receivables
3. Accountant
4. Reception
Please enter the number to connect to:

Typing 1 and pressing ENTER would run the Shell command above.

Can anyone help??

TIA, Alan


--

Dave Peterson


All times are GMT +1. The time now is 08:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com