View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
SP[_7_] SP[_7_] is offline
external usenet poster
 
Posts: 3
Default Launch external application

On Feb 26, 6:38 pm, Vergel Adriano
wrote:
Assuming the IP address is in A1, I believe this should work

CalcTaskID = Shell(AppFile & " " & Range("A1").Text, vbNormalFocus)

"SP" wrote:
On Feb 26, 5:42 pm, "SP" wrote:
I use excel to track information on a couple hundred switches and was
wondering if the following is possible.


Each row contains information on each switch including its IP address,
is it possible to launch an external application and pass the IP
address stored in the cell. The program I use is called putty and and
I can launch it from the command line with "putty 10.3.14.19".


Thanks
Sal


I have entered the following code and assigned it to an object:


Sub ActivateCalculator()
AppFile = "putty.exe"
On Error Resume Next
AppActivate "Putty"
If Err < 0 Then
CalcTaskID = Shell(AppFile, vbNormalFocus)
If Err = 0 Then MsgBox "Unable to start the Calculator"
End If
End Sub


This works, when I click on the object the application starts.


I would like to pass the IP address stored in the cell to the
application.


Any suggestions.


Thanks
Sal



I edited the code so it pulls the data from the active cell.

Sub ActivatePutty()
Worksheets("Hosts").Activate
IP = ActiveCell.Value
AppFile = "putty.exe"
On Error Resume Next
AppActivate "putty"
If Err < 0 Then
CalcTaskID = Shell(AppFile & " " & IP, vbNormalFocus)
If Err = 0 Then MsgBox "Unable to start the Calculator"
End If
End Sub

Thanks for the help