-
Jul 29th, 2021, 05:31 AM
#1
Thread Starter
New Member
VBA Get Internet Connection Status Problem
I have an issue, which I could not find a solution. I need a code to check the Internet availability and turn a result true or false. I have almost tried all the codes I found at internet. However I have a problem as follows:
When I disconnect LAN or WIFI the codes work fine. However in case either way the DSL line is down (If I turn off DSL modem or disconnect the line connection to DSL), or even If I connect wifi through a mobile phone Hotspot but turn off mobile connection (So there is no internet)
codes always turn to a true result. (They believe there is active internet)
So what could be wrong?
Thanks
-
Jul 29th, 2021, 07:35 AM
#2
Re: VBA Get Internet Connection Status Problem
Is this a VBA question or a VB.NET question? If it's the former, why is it posted in the VB.NET forum? If it's the latter, why does it say VBA in the title?
-
Jul 30th, 2021, 07:49 AM
#3
Re: VBA Get Internet Connection Status Problem
as you have not specified what codes you found on the net, hard to say, but most of the methods, while they say internet, it is really only checking if there is a network connection of any type, may have worked more correctly when internet was basically all dial up, but may still have been incorrect if there was a network connection as well as a dial up or using internet connection sharing
my best suggestion would be to ping your ISP or someother close server, to see if you get a valid response, if you are checking multiple connections your ISP may not be the best option, and you need to test the IP you choose is not set to ignore pings
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Aug 9th, 2021, 07:44 PM
#4
Fanatic Member
Re: VBA Get Internet Connection Status Problem
i just stumbles upon something that might be possible to use
Possibly something you can use
its running a ping using shell, now to automate this process your going to have to grab the window and check its contents, luckily ping writes the same thing, either ping failed or ping ping ping generally speaking, this method requires most likely using windows API if thats something your comfortable with. (its not hard really, lots of documentation out there)
Yes!!!
Working from home is so much better than working in an office...
Nothing can beat the combined stress of getting your work done on time whilst
1. one toddler keeps pressing your AVR's power button
2. one baby keeps crying for milk
3. one child keeps running in and out of the house screaming and shouting
4. one wife keeps nagging you to stop playing on the pc and do some real work.. house chores
5. working at 1 O'clock in the morning because nobody is awake at that time
6. being grossly underpaid for all your hard work
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|