Hi, how do I start this function ?
I want to test if my internet connection ok before he gone make connection to the api database
(he do this 24 h in a time loop)
I put
call CheckConnection
but he said ' can not find"


Option Explicit

Private Declare PtrSafe Function InternetGetConnectedStateEx Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal lpszConnectionName As String, ByVal dwNameLen As Integer, ByVal dwReserved As Long) As Long
Dim sConnType As String * 255


Private Sub CheckConnection()
    Dim Ret As Long
TestConn:
    Ret = InternetGetConnectedStateEx(Ret, sConnType, 254, 0)
    If Ret = 1 Then
    Exit Sub
    Else
        Application.Wait (Now + TimeValue("0:03:00"))
        GoTo TestConn
    End If
End Sub
Or should it not be a private at all (found on the code on this website)

Thanks
Chris