Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default checking for a connection to the web

Hi,

I have a program that opens up a file on a server, the user will have
to be online for this to happen, is there any code i can you to check
weather the user has a connection.

regards

johny

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default checking for a connection to the web

See Randy Birch's site/pages at www.mvps.org

--
Regards,
Tom Ogilvy

wrote in message
ups.com...
Hi,

I have a program that opens up a file on a server, the user will have
to be online for this to happen, is there any code i can you to check
weather the user has a connection.

regards

johny



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default checking for a connection to the web

Here's a simple version that might help.

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

Public Function IsNetConnected() As Boolean
Dim lReturn As Long

'you might want to put a get out clause in here that returns true
'if the test is taking place behind a proxy server, which sometimes doesn't
work
'e.g. this checks a registry setting for an option to disable the function
'you can omit the next 4 lines if this is beyond your needs
If CBool(GetSetting("ProgName", "Settings", "DisableNetDetect", "FALSE"))
Then

IsNetConnected = True
Exit Function

End If

IsNetConnected = InternetGetConnectedState(lReturn, 0)

If IsNetConnected = False Then _
IsNetConnected = InternetCheckConnection("http://www.yahoo.com", 1, 0)

If IsNetConnected = False Then _
MsgBox "You do not appear to have an active internet connection at this
time" _
& vbcrlf & "Please connect to the internet then retry this command",
_
vbOKOnly + vbInformation

End Function

Robin Hammond
www.enhanceddatasystems.com

wrote in message
ups.com...
Hi,

I have a program that opens up a file on a server, the user will have
to be online for this to happen, is there any code i can you to check
weather the user has a connection.

regards

johny



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
always recheck data connection library for latest connection strin FurmanGG Excel Discussion (Misc queries) 0 September 14th 07 04:48 PM
Spell Checking with checking cell notes jfitzpat Excel Discussion (Misc queries) 0 August 8th 07 10:26 PM
no DDE connection?? askmiller Excel Discussion (Misc queries) 0 August 5th 06 09:19 PM
Checking if you have a network connection clayton Excel Discussion (Misc queries) 0 May 31st 06 04:31 PM
SQL Connection Adul Excel Programming 0 November 4th 04 08:24 AM


All times are GMT +1. The time now is 07:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"