VBA判断是否连接公司内网/是否联网(Excel)
发布网友
发布时间:2023-06-03 18:02
我来回答
共1个回答
热心网友
时间:2024-11-16 13:46
Function 测网(url)
On Error Resume Next
cmdping = "ping " & url & " -n 1"
Set oExec = CreateObject("Wscript.shell").exec(cmdping)
Do Until oExec.stdout.AtEndOfStream
strline = strline & oExec.stdout.readline() & Chr(13)
Loop
测网 = 0
If InStr(strline, "回复") Then 测网 = 1
Set oExec = Nothing
End Function
Function 联网提示(url)
If 测网(url) = 0 Then
tip = Time & " 请确认是否连接上公司内网。"
Debug.Print tip
MsgBox tip
End
End If
End Function