+ Reply to Thread
Results 1 to 8 of 8

Error 1004 with Web query

  1. #1
    Registered User
    Join Date
    12-08-2009
    Location
    UK
    MS-Off Ver
    XL 2003
    Posts
    8

    Error 1004 with Web query

    Hello Guys,

    I have a freaking problem coming from a Web Query. Actually, I get an "Execution Error 1004" because of the following piece of code:
    Please Login or Register  to view this content.
    Technically, I am not able to understand why this line is stopping the procedure and don’t really know how to resolve the corresponding issue. I guess that is a common problem.

    Here is the complete URL which is used within this procedure:
    Please Login or Register  to view this content.
    Have a nice time

    Thanks,
    John
    Last edited by Johny027; 12-13-2009 at 10:19 AM. Reason: Thanks to Chippy

  2. #2
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Error 1004 with Web query

    Just had a quick look at your code.

    URL = aurl & ... looks wrong. Probably should be URL = URL & ...

    Which line causes the error? Step through the code line by line in the VB debugger to find out.

    Add a new sheet whilst the Macro Recorder is running to find out the code for adding a new sheet. The code produced can usually be shortened (e.g. lines with .Select can be combined with the following line), but it should give you a good starting point.

  3. #3
    Registered User
    Join Date
    12-08-2009
    Location
    UK
    MS-Off Ver
    XL 2003
    Posts
    8

    Re: Error 1004 with Web query

    Thanks for your suggestion Chippy, you are right I mistyped URL.

    However, the following line is still causing the error 1004:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-08-2009
    Location
    UK
    MS-Off Ver
    XL 2003
    Posts
    8

    Re: Error 1004 with Web query

    Quote Originally Posted by Chippy View Post
    Add a new sheet whilst the Macro Recorder is running to find out the code for adding a new sheet. The code produced can usually be shortened (e.g. lines with .Select can be combined with the following line), but it should give you a good starting point.
    I am still trying to resolve the first problem and unfortunately did not get new ideas with the Macro Recorder...

  5. #5
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Error 1004 with Web query

    Please Login or Register  to view this content.
    What is in cells B1, B2 and B3? What is the complete URL after the last line above has been executed? Does this URL work in a manual web query?

    To add and name a new sheet at the end of the existing sheets use:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    12-08-2009
    Location
    UK
    MS-Off Ver
    XL 2003
    Posts
    8

    Re: Error 1004 with Web query

    Thank you for your continuing support Chippy!

    There is a ticker like GOOG in B1 and the corresponding dates within B2 & B3 (12/09/08 & 12/09/09 for instance).

    Here is the complete URL which is manually working:
    Please Login or Register  to view this content.
    Last edited by Johny027; 12-09-2009 at 03:32 PM. Reason: Adding code

  7. #7
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Error 1004 with Web query

    Try this code in a new workbook. It needs 2 sheets - In and Out. On the In sheet, put the tickers in column A, start dates in column B and end dates in column C. Row 1 is expected to contain column headings, so the first ticker symbol should be placed in A2, with its dates in B2 and C2. Then run the macro.

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    12-08-2009
    Location
    UK
    MS-Off Ver
    XL 2003
    Posts
    8

    Re: Error 1004 with Web query

    Again, thank you for your help Chippy.


    You did a great job. This is simply what I expected; your code is working fine.

    The Web Query is definitely the fastest way to get ticker's data from web.


    Have a nice Sunday

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1