P
PhrozenRoad
Hey guys is there a way to output the results of this macro to a cell
like
if ("cmd /c C:\WINDOWS\system32\ping.exe -t " & Replace(C.Value, "connected
", ""), vbMaximizedFocus) = "Reply from" then (0,1).Value="Pinged!"
if ("cmd /c C:\WINDOWS\system32\ping.exe -t " & Replace(C.Value, "connected
", ""), vbMaximizedFocus) = "Request timed out"C.Offset(0,1).Value="Failed!"
**********************************************************
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
'adds Value to cell to show script attempt has been made
C.Offset(0,1).Value="Pinged!"
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
like
if ("cmd /c C:\WINDOWS\system32\ping.exe -t " & Replace(C.Value, "connected
", ""), vbMaximizedFocus) = "Reply from" then (0,1).Value="Pinged!"
if ("cmd /c C:\WINDOWS\system32\ping.exe -t " & Replace(C.Value, "connected
", ""), vbMaximizedFocus) = "Request timed out"C.Offset(0,1).Value="Failed!"
**********************************************************
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
'adds Value to cell to show script attempt has been made
C.Offset(0,1).Value="Pinged!"
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