And here it is modified to prompt to connect
Option Explicit
Private Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpSFlags As Long, ByVal dwReserved As Long) As Long
Private Declare Function InternetAutodial Lib "wininet.dll" (ByVal dwFlags As Long, ByVal dwReserved As Long) As Long
Private Const INTERNET_AUTODIAL_FORCE_ONLINE = 1
Private Function ConnectedToInternet() As Boolean
ConnectedToInternet = InternetGetConnectedState(0&, 0&)
End Function
Private Sub Command1_Click()
If ConnectedToInternet = False Then
InternetAutodial INTERNET_AUTODIAL_FORCE_ONLINE, 0
End If
End Sub