Results 1 to 4 of 4

Thread: VBA Get Internet Connection Status Problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2021
    Posts
    1

    Post 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

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,350

    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?

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: VBA Get Internet Connection Status Problem

    So what could be wrong?
    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

  4. #4
    Fanatic Member
    Join Date
    Feb 2013
    Posts
    985

    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
  •  



Click Here to Expand Forum to Full Width