Excel 批量查看IP是否ping通
function Ping(strip)
dim objshell,boolcode
set objshell=CreateObject("WScipt.Shell")
boolcode=objshell.Run("ping -n 1 -w 1000 " & strip , 0, True)
if boolcode = 0 then
Ping = true
else
Ping =false
end if
end function
Sub PingSystem()
dim strip as string
rowcount =ActiveSheet.Cells(65536,2).End(xlUp).Row
for introw = 2 to rowcount
strip = ActiveSheet.Cells(introw,2).value
if Ping(strip) = True then
ActiveSheet.Cells(introw,3).value="Online"
else
ActiveSheet.Cells(introw,3).value="Offline"
end if
end sub
评论已关闭