Internet connection?
Using VBA codes I can now determine whether Microsoft Outlook or Outlook Express is installed on a PC with the help from Michel Pierron. Can using VBA codes determine whether a PC is connected to the internet or intranet? Any help is very much appreciated.
|
Internet connection?
You can start at Randy Birch's site:
http://vbnet.mvps.org/code/network/i...ectedstate.htm -- Regards, Tom Ogilvy Francis Ang" wrote in message ... Using VBA codes I can now determine whether Microsoft Outlook or Outlook Express is installed on a PC with the help from Michel Pierron. Can using VBA codes determine whether a PC is connected to the internet or intranet? Any help is very much appreciated. |
Internet connection?
Francis,
try these API calls. I played with this for a while myself until I found this combination that seems to give a reliable result. Option Explicit Option Private Module Private Declare Function InternetGetConnectedState Lib "wininet" _ (ByRef dwFlags As Long, _ ByVal dwReserved As Long) As Long Private Declare Function InternetCheckConnection Lib "wininet.dll" _ Alias "InternetCheckConnectionA" (ByVal sUrl As String, _ ByVal lFlags As Long, ByVal lReserved As Long) As Long Sub Test If IsNetConnected = FALSE then Exit Sub 'do something internet related End Sub Public Function IsNetConnected() As Boolean Dim lReturn As Long IsNetConnected = InternetGetConnectedState(lReturn, 0) 'pick an IP or net address to go in the function call If IsNetConnected = False Then _ IsNetConnected = InternetCheckConnection("http://www.yahoo.com", 1, 0) If IsNetConnected = False Then _ Call MsgBox("You do not appear to have an active internet connection at this time" _ & vbcrlf & vbcrlf & "Please connect to the internet then retry this command", _ vbOKOnly + vbInformation, msgTitle) End Function HTH, Robin Hammond www.enhanceddatasystems.com "Francis Ang" wrote in message ... Using VBA codes I can now determine whether Microsoft Outlook or Outlook Express is installed on a PC with the help from Michel Pierron. Can using VBA codes determine whether a PC is connected to the internet or intranet? Any help is very much appreciated. |
Internet connection?
Tom, Robin, Thank you very much for your assistance.
|
All times are GMT +1. The time now is 07:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com