Accessing a specific website

  • I have been trying to use excel to access a website, fill in information and submit. The code on the website is listed below.


    I would like to input a number into the "item", select "xls" and then submit. I have looked up ways to interact with the internet, but they do not seem to work. Please be aware that I have no experience with interacting with the internet through excel and would appreciate some code rather than simply a link.

  • Re: Accessing a specific website


    Try this code. You must set references to Microsoft Internet Controls and Microsoft HTML Object Library via Tools -> References in the VBA editor, otherwise the code won't compile or run.


  • Re: Accessing a specific website


    John_w,


    Thank you for the help, but I am having an issue when I try to run the macro. I am receiving a runt-time error '-2147467259 (80004005)' Automation error Unspecified error and the debuger is highlighting While .Busy Or .readyState <> READYSTATE_COMPLETE. Do you know what would be causing this?

  • Re: Accessing a specific website


    Did you change the URL string?


    Try this, using a known working site, ozgrid.com. Also note the explicit use of the SHDocVw library for the InternetExplorer object, though this shouldn't make any difference (no additional references are needed). You could try the same change on my previous code.


  • Re: Accessing a specific website


    John_w,


    Both sets of code works for the ozgrid website, but not for the company website I am trying to use. I get the same error message for both sets of code when I try the website I am trying to use. Both sets of code do open up the website, but the second set of code errors out at the "While .Busy Or .readyState <> READYSTATE_COMPLETE" line

  • Re: Accessing a specific website


    Try changing the Busy readyState wait to separate loops:

    Code
    While .Busy
                DoEvents
            Wend
            While .readyState <> READYSTATE_COMPLETE
                DoEvents
            Wend

    That may work. If not it may tell you which of Busy or readyState is causing the problem.

Participate now!

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