I'm not sure what to call this

P

PhrozenRoad

but here is what i am trying to accomplish
when i select a colum of cells i initate a macro that runs on each of the
cells seperately then places "connected " in the cell prior to the
workstation name
what i would like it to do is if it completes the ping or vnc or termsev or
whatever script i initate it places a "done" or "pinged!" or "connected"
into a cell to the right of it does anyone have any suggestions as i am new
to excel programming but have had a lot of luck with making this work
here is a sample of the code i have been using
********************************
Sub AddPingString()
Dim TheRange As Range, iMsgBox As Integer
Dim retval As Integer

If TypeName(Selection) = "Range" Then

'get the range of cells to modify
Set TheRange = Application.Selection
'loop through the cells in the range object
For Each C In TheRange.Cells
'use data from selected cell if not hidden
If C.EntireRow.Hidden = False And C.Value <> "" Then
'if 10 spaces is before the server name does not =
"connected " then
If Left(C.Value, 10) <> "connected " Then
'add "connected "
C.Value = "connected " & C.Value
End If
'open cmd prompt and start conn, replace cell value
"connected " with "" leaving only system name
retval = Shell("cmd /c C:\WINDOWS\system32\ping.exe
-t " & Replace(C.Value, "connected ", ""), vbMaximizedFocus)
End If
Next

Else
iMsgBox = MsgBox("Select some cells.", vbInformation, "Error")
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top