Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Andy Dawkins" wrote:
Thank you urkec for your responce. I noticed that you mentioned that Win32_PingStatus was added for windows XP. If I'm using Windows 2000 what would I need to do to make it work? I found that code he http://www.rlmueller.net/PingComputers.htm You can find other two samples there, one uses WScript.Shell Exec method to execute the Ping command and then checks it's output to determine if ping was successful. The other uses WScript.Shell Run method. Both will work with Windows 2000 (the first sample requires Windows Script Host 5.6, the other WSH 5.1) If you use WshShell.Exec you won't be able to prevent Command Prompt appearing on the screen, if you use WshShell.Run you will have to write the Ping command output to a temporary txt file, so those are not ideal solutions. The samples are VBScript, VBA the code would look something like this: Function Ping2(ByVal Host As String, _ ByVal Pings As Integer, ByVal TimeOut As Integer) As Boolean Status = CreateObject("WScript.Shell"). _ Exec("%comspec% /c Ping -n " & CStr(Pings) & _ " -w " & CStr(TimeOut) & " " & Host).StdOut.ReadAll 'Debug.Print Status If InStr(Status, "TTL=") = 0 Then Ping2 = False Else Ping2 = True End If End Function Then you can call Ping2 like this: Ping2("ANAME", 1, 750) -- urkec |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Ping from Excel - Almost there | Excel Programming | |||
PING within Excel Cell | Excel Worksheet Functions | |||
Excel Ping Command..via web... | Excel Programming | |||
Ping results into Excel | Excel Programming | |||
ping in excel | Excel Programming |