View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_13_] Leith Ross[_13_] is offline
external usenet poster
 
Posts: 2
Default How can I link (not embed) to a graphic on the internet in Excel?

On Feb 20, 1:48 pm, Ray Carter
wrote:
I am wanting to use a graphic (online image) in my worksheet, or is there a
way to test for internet access in excel. Either way what I want to do is
have an 'Online' graphic display if they are connected to the internet.

My original thinking was to post the graphic on my website and simply pull
it in and display it when they were connected. Can't figure that out
either....

If someone has a relatively easy way to do this could you please help.

Thanks in advance
Ray



Hello Ray,

I can help answer part of your question, how to determine if the user
is connected. As simple as this seems it ought to be it isn't. This
quote of Allen Weng of Microsoft sums the problem up:

"Actually, there is no single function for determining if a machine is
connected to the Internet, and it is impossible to reliably determine
what is happening without side effects - such as automatic network
connections taking place. What you can do is reliably detect when
there definitely isn't an Internet Link: in the absence of any dial up
or LAN connection the system is definitely off line."

Here is a link that explains more about detection problems associated
with different system setups...
http://www.ndis.com/faq/QA05040101.htm

Here is macro that works well in most cases.
Macro Code:

'Note: WinINet dial-up functions do not support double-dial
connections,
'SmartCard authentication, or connections that require registry-based
certification.
'For more information connection states go to http://www.ndis.com/faq/QA05040101.htm

'Flags for GetInternetState, these are returned
Public Const INTERNET_CONNECTION_MODEM As Long = &H1
Public Const INTERNET_CONNECTION_LAN As Long = &H2
Public Const INTERNET_CONNECTION_PROXY As Long = &H4
Public Const INTERNET_CONNECTION_MODEM_BUSY As Long = &H8
Public Const INTERNET_RAS_INSTALLED As Long = &H10
Public Const INTERNET_CONNECTION_OFFLINE As Long = &H20
Public Const INTERNET_CONNECTION_CONFIGURED As Long = &H40

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

Public Declare Function AttemptToConnect _
Lib "Wininet.dll" _
Alias "InternetAttemptConnect" _
(ByVal Reserved As Long) As Long

Public Declare Function GoOnline _
Lib "Wininet.dll" _
Alias "InternetGoOnlineA" _
(ByVal lpszURL As String, _
ByVal hwndParent As Long, _
ByVal Reserved As Long) As Long

Public Function IsComputerOnline() As Boolean

Dim Flags As Long
Dim Ret

Ret = GetInternetState(Flags, 0&)
IsComputerOnline = Ret And Not (Flags And
INTERNET_CONNECTION_OFFLINE)

End Function

Sincerely,
Leith Ross