Verifying Internet Access

T

TH

I need a way (using VBA) to test whether or not the user is connected to the
internet. Better yet, to test if the desired site for a web connect is
available. I retrieve stock quotes online for analysis. The obvious
situation is a user is on a plane and still wants to use the model for
analysis, but it auto checks for a current quote. If the quote page is not
available I will simply return without changing the quotes.

Any ideas on how to do this? Is there an error message from a web query?

Thanks, Terry


I searched the google files and found this (incomplete) suggestion from 1999
regarding testing a site:

Hi Tony,
only an idea, but how about writing a batch file that uses tracert on
the various links. Output the texts to files.
eg tracert microsoft.com > microsoft.txt
execute the file using shell
eg shell ("c:\test.bat")
Loop until the last file has been created
x= dir ("c:\mylastfile.txt")
do
x=dir
loop while x =""
then read the contents of the file to see if the destination was found.

Not a great solution , but the best I can think of!
 
J

Jim Gordon

Hi TH,

Excel will generate an error that's trappable using VBA.

Just make a web query to a file on your hard drive, then change the source
file's name. Run the query again to see the error # to trap.

-Jim Gordon
Mac MVP

All responses should be made to this newsgroup within the same thread.
Thanks.

About Microsoft MVPs:
http://www.mvps.org/

Search for help with the free Google search Excel add-in:
<http://www.rondebruin.nl/Google.htm>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top