VBA - Web Query URL length

silentbuddha

Board Regular
Joined
Mar 1, 2008
Messages
112
Hi,

I am currently using VBA to import data from the web. However, I keep getting the run-time error 1004 and it occurs at this part of the code

Code:
.Refresh BackgroundQuery:=False

I check the url string length and it is 1147 characters...

Currently using IE 8 // WinXP

Is my url = "URL;http//......" string length too long ?

Thanks :)
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I would try shortening the URL length to extremely short to test out your theory. I have run into that problem before as I think each web site may have their own max number of characters you can query through the URL.

I found out where the max was for me using Yahoo queries, then made sure I sent only around 90% of that value or so on each query. But I was not getting the 1004 run time errror.

Also your line of code:
Code:
.Refresh BackgroundQuery:=False
is the one that is telling the rest of your VBA code to wait for the query to be completed before your next line of VBA code will start. I have had troube there before when it was conflicting with other programs I also had running at the same time on same computer. One of those other programs had their own "wait" feature too so they conflicted.

Chuck
 
Upvote 0
I looked back at my older notes and I have gotten that run time error 1004 occassionally when doing a web query to Yahoo.

It looks like Andrew found the answer to a similar error for someone else by suggesting they "enable ActiveX controls". His suggestion is post #6 here:
http://www.mrexcel.com/forum/showthr...ght=error+1004

And here is the link he suggested:
http://office.microsoft.com/en-us/ex...010031067.aspx

I haven't had a chance yet to see if this fixes my occassional run-time error 1004 during my many automated querys to Yahoo in one of my programs.

If you try it and it fixes your 1004 error let us know.

Chuck
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,844
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top