ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Internetconnection (https://www.excelbanter.com/excel-programming/345514-internetconnection.html)

Jos Vens[_2_]

Internetconnection
 
Hi,

I wonder if it is possible to see if someone has connection to the internet
on startup of the application.

Now I download a small file and if it succeeds, I know the user has
connection, but it seems to be a little slow. Is there a command like:

if (InternetConnection) then
msgbox "The user is connected to the internet", vbOKOnly
else
msgbox "The user is not connected to the internet", vbOKOnly
end if

Thanks
Jos Vens



NickHK

Internetconnection
 
Jos,
Try Karl's excellent site:
http://vb.mvps.org/articles/ap199812.pdf

NickHK

"Jos Vens" wrote in message
...
Hi,

I wonder if it is possible to see if someone has connection to the

internet
on startup of the application.

Now I download a small file and if it succeeds, I know the user has
connection, but it seems to be a little slow. Is there a command like:

if (InternetConnection) then
msgbox "The user is connected to the internet", vbOKOnly
else
msgbox "The user is not connected to the internet", vbOKOnly
end if

Thanks
Jos Vens





Jos Vens[_2_]

Internetconnection
 
Hi Leith,

it works flashing fast! Thanks!!!!

Jos

"Leith Ross"
schreef in bericht
...

Hello Jos,

Here is a macro that tests if you are connected to the internet or not.
This will work with dialup, DSL, and most LANs. If you have a LAN with
auto dial it may not work. This works with Windows 95, 98, ME, 2000. I
haven't used it on 2003. So if you are running 2003 you should test it
and see if it works correctly. Add a VBA module to your project and
copy this code into it. The function returms true if you are connected
to the internet and false uf you are not.

EXAMPLE:
Answer = IsInternetConnected


Code:
--------------------
Public Declare Function GetInternetState _
Lib "Wininet.dll" _
Alias "InternetGetConnectedState" _
(ByVal lpdwFlags As Long, _
ByVal Reserved As Long) As Long

Public Function IsInternetConnected() As Boolean

Dim Flags As Long
Dim Ret

Ret = GetInternetState(Flags, 0&)
IsInternetConnected = Ret

End Function

--------------------

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile:
http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=484772





All times are GMT +1. The time now is 09:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com