View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JB[_2_] JB[_2_] is offline
external usenet poster
 
Posts: 6
Default Macro Ran in Excel 97 but in XP. What Needs Changing

Hello,
I have inherited a macro that ran fine with Excel 97 & Excel 2000 but
does not run with Excel XP.
I get the following error message when I run the macro now.

Application-defined or object-defined error Run-time error ‘1004'

The error seems to be in .BackgroundQuery = True see section
of code below. How do I need to change this so it run in Excel XP?

Thanks
JBEsr


Range("C7").CurrentRegion.ClearContents
i = 7
qurl = "http://finance.yahoo.com/d/quotes.csv?s=" + Cells(i, 1)
i = i + 1
While Cells(i, 1) < ""
qurl = qurl + "+" + Cells(i, 1)
i = i + 1
Wend
qurl = qurl + "&f=" + Range("C2")
Range("c1") = qurl
QueryQuote:
With ActiveSheet.QueryTables.Add(Connection:="URL;" &
qurl, Destination:=Sheets("yahoo").Range("C7")) 'JBE

.BackgroundQuery = True <<<Error Here

.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With