Function checkInternetConnection() As Integer
    'Please add reference of Microsoft XML, v3.0
    On Error Resume Next
    checkInternetConnection = False
    Dim http As ServerXMLHTTP
    Dim varProjectID, varCatID, strT As String
    Set http = New ServerXMLHTTP
    http.Open "GET", "http://www.google.com"
    http.setRequestHeader "Accept", "application/xml"
    http.setRequestHeader "Content-Type", "application/xml"
    http.send strT
    If Err = 0 Then
        checkInternetConnection = True
        MsgBox "Internet connection established"
    Else
        MsgBox "Internet connection not established: " & Err.Description & "", 64, "No Internet Connection Found!"
    End If
End Function

Private Declare PtrSafe Function InternetGetConnectedState Lib "wininet.dll" _
(ByRef dwflags As Long, ByVal dwReserved As Long) As Long

Public Function GetInternetConnectedState() As Boolean
  MsgBox InternetGetConnectedState(0&, 0&) ' 1 = Yes   0 = No
End Function