Private Declare Function IsNetworkAlive Lib "SENSAPI.DLL" _
(ByRef lpdwFlags As Long) As Long
Sub verificationConnection()
Select Case IsNetworkAlive(0)
Case 0
MsgBox "not connected"
Case 1
MsgBox "connected to LAN"
Case 2
MsgBox "connected to WAN"
Case Else
MsgBox "connected to other network"
End Select
End Sub