LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Problem with the Web Query

I have certain urls which gives current stock price for that perticuler
stock. I created web query to get those results from web to excel
sheet. Althougt the url is currect and works when pasted on browsers
url box, it fails in the vba code. The error is run time error 1004.
The address of the site is not valid. Check the address and try again.
VBA code fails on line .Refresh BackgroundQuery:=False as indicated
below.
Please note that if I run individual web querry with the same hardcoded
url, it works.
Request some light on this.
Regards,

My code as below.

Sub GET_PRICE_ALL()
R = 1
Sheets("MYLINKS").Select
Sheets("MYLINKS").Range("A" & R).Activate

Do Until IsEmpty(ActiveCell)
MYURL = ActiveCell.Value
GET_PRICE (MYURL)
Sheets("MYLINKS").Activate
ActiveCell.Offset(1, 0).Select
R = R + 1
Loop
End Sub
Sub GET_PRICE(MYURL As String)
Sheets("RESULT").Select
Sheets("RESULT").Range("A" & R + 5).Activate
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;MYURL" _
, Destination:=Sheets("RESULT").Range("A" & R + 5))
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingAll
.WebTables = "10"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False <<===here vba code fails.
End With

End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Query problem Keith H[_2_] Excel Discussion (Misc queries) 2 December 16th 09 04:30 PM
Ms Query problem Janie Excel Discussion (Misc queries) 2 September 19th 06 07:25 PM
Problem with MS Query - can't edit query jarems Excel Discussion (Misc queries) 2 December 12th 05 09:42 AM
Problem with Query John Links and Linking in Excel 4 December 7th 04 02:49 PM
Problem with .Background Query option of ODBC Query Shilps Excel Programming 0 April 19th 04 06:41 AM


All times are GMT +1. The time now is 01:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"