Read Internet file as read on computer?

  • Wilker,
    Check into XMLHttpRequest. You can request a webpage and download a file or simply read it from VBA. The below code is untested because I am on Linux but give it a shot it should point you in the right direction.


  • Here is an alternative to XMLHTTP using ServerXMLHTTP. XMLHTTP is designed for client applications built upon Microsoft Win32 Internet (WinInet). ServerXMLHTTP is designed for server applications (HTTP client stack, WinHTTP). As a general statement ServerXMLHTTP is quite robust and is server safe. ServerXMLHTTP is recommended for server applications and XMLHTTP is recommended for client applications and both have their advantages depending on the needs of the application.


    As in the commented code I would recommend to have some more specific error handling - if there is a problem then more direct error handling will help you narrow down the cause and will make the application more user friendly. If the specific error is of no concern to you simply use a catch all. I would always recommend error handling with this type of application. As you would appreciate a lot of unforeseen errors may occur when reading data over the internet. The second sub is simply to write the data scraped to a text file - modify the destination to your needs.
    If you are interested in the difference between XMLHTTP and ServerXMLHTTP then there is a good discussion here -> https://support.microsoft.com/en-au/...-serverxmlhttp

    Regards
    [SIZE=3]Anthony
    [/SIZE]&WCF_AMPERSAND[SIZE=3]
    [/SIZE]&WCF_AMPERSAND&WCF_AMPERSAND&WCF_AMPERSAND[SIZE=2]You have your way. I have my way. As for the right way, the correct way, and the only way, it does not exist.[/SIZE]




Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!