![]() |
Cant query a web page
I am using Excel 2000....using the same querytables function i can get just
about any page to come up...... For some reason a page that will come up in the Internet explorer will return no data when I perform the function.... Can anyone tell me why the page returns no data even thought the web page exists? examples: 'This works fine Sub Test1() v = "URL;http://baseball.fantasysports.yahoo.com/b1/338255" QueryTables.Add(Connection:=v, Destination:=Range("AD1")).Refresh BackgroundQuery = True End Sub 'This returns no data even though the page exists Sub Test2() v = "URL;http://baseball.fantasysports.yahoo.com/b1/338255/2" QueryTables.Add(Connection:=v, Destination:=Range("AD1")).Refresh BackgroundQuery = True End Sub |
Cant query a web page
It doesn't work because you did not tell the workbook where to put the information it's taken off the site. Update your code to the below and it should work for you. You were telling it to run the query and to post it to cell "AD1", but it didn't know what sheet to put it on. If you want it on a different sheet Then the ActiveSheet, replace it with ThisWorkBook.Sheets("Sheet Name").Query..... Sub Test1() v = "URL;http://baseball.fantasysports.yahoo.com/b1/338255" ActiveSheet.QueryTables.Add(Connection:=v, Destination:=Range("AD1")).Refresh BackgroundQuery = True End Sub 'This returns no data even though the page exists Sub Test2() v = "URL;http://baseball.fantasysports.yahoo.com/b1/338255/2" ActiveSheet.QueryTables.Add(Connection:=v, Destination:=Range("AD1")).Refresh BackgroundQuery = True End Sub Gary Wrote: I am using Excel 2000....using the same querytables function i can get just about any page to come up...... For some reason a page that will come up in the Internet explorer will return no data when I perform the function.... Can anyone tell me why the page returns no data even thought the web page exists? examples: 'This works fine Sub Test1() v = "URL;http://baseball.fantasysports.yahoo.com/b1/338255" QueryTables.Add(Connection:=v, Destination:=Range("AD1")).Refresh BackgroundQuery = True End Sub 'This returns no data even though the page exists Sub Test2() v = "URL;http://baseball.fantasysports.yahoo.com/b1/338255/2" QueryTables.Add(Connection:=v, Destination:=Range("AD1")).Refresh BackgroundQuery = True End Sub -- dok112 ------------------------------------------------------------------------ dok112's Profile: http://www.excelforum.com/member.php...o&userid=10581 View this thread: http://www.excelforum.com/showthread...hreadid=532458 |
Cant query a web page
The code is written in the sheet module so it doesn't matter about the
activesheet variable. Even so, it still doesn't work. "dok112" wrote: It doesn't work because you did not tell the workbook where to put the information it's taken off the site. Update your code to the below and it should work for you. You were telling it to run the query and to post it to cell "AD1", but it didn't know what sheet to put it on. If you want it on a different sheet Then the ActiveSheet, replace it with ThisWorkBook.Sheets("Sheet Name").Query..... Sub Test1() v = "URL;http://baseball.fantasysports.yahoo.com/b1/338255" ActiveSheet.QueryTables.Add(Connection:=v, Destination:=Range("AD1")).Refresh BackgroundQuery = True End Sub 'This returns no data even though the page exists Sub Test2() v = "URL;http://baseball.fantasysports.yahoo.com/b1/338255/2" ActiveSheet.QueryTables.Add(Connection:=v, Destination:=Range("AD1")).Refresh BackgroundQuery = True End Sub Gary Wrote: I am using Excel 2000....using the same querytables function i can get just about any page to come up...... For some reason a page that will come up in the Internet explorer will return no data when I perform the function.... Can anyone tell me why the page returns no data even thought the web page exists? examples: 'This works fine Sub Test1() v = "URL;http://baseball.fantasysports.yahoo.com/b1/338255" QueryTables.Add(Connection:=v, Destination:=Range("AD1")).Refresh BackgroundQuery = True End Sub 'This returns no data even though the page exists Sub Test2() v = "URL;http://baseball.fantasysports.yahoo.com/b1/338255/2" QueryTables.Add(Connection:=v, Destination:=Range("AD1")).Refresh BackgroundQuery = True End Sub -- dok112 ------------------------------------------------------------------------ dok112's Profile: http://www.excelforum.com/member.php...o&userid=10581 View this thread: http://www.excelforum.com/showthread...hreadid=532458 |
Cant query a web page
It's something wrong with your system then. The code works just fine when I run it on my Excel. It pulls all th data and posts it into Excel -- dok11 ----------------------------------------------------------------------- dok112's Profile: http://www.excelforum.com/member.php...fo&userid=1058 View this thread: http://www.excelforum.com/showthread.php?threadid=53245 |
Cant query a web page
I just retried it. It's working on Microsoft Excel 2002. It's posting the below starting in cell AD1 as referenced. Yahoo! My Yahoo! Mail Make Yahoo! your home page Search the web Yahoo! Sports Sign In New User? Sign Up Sports Home - Fantasy Sports Batting Pos Batters Action Opp Status H/AB R HR RBI SB AVG C B. Molina The add action is disabled Watch List is not available @Bos 4:05 PM -/- - - - - - (Tor - C) 1B A. Pujols The add action is disabled Watch List is not available Mil L, 4-3 0/3 1 0 0 1 0 (StL - 1B) 2B A. Soriano The add action is disabled Watch List is not available NYM L, 13-4 5-Jan 0 0 0 0 0.2 (Was - 2B,OF) 3B S. Hillenbrand The add action is disabled Watch List is not available @Bos 4:05 PM -/- - - - - - (Tor - 1B,3B) SS R. Furcal The add action is disabled Watch List is not available @Pit W, 13-5 4-Jan 1 0 0 0 0.25 (LAD - SS) OF T. Hunter The add action is disabled Watch List is not available Oak W, 8-2 4-Jan 1 1 2 0 0.25 (Min - OF) OF A. Rowand The add action is disabled Watch List is not available @Atl 4:35 PM -/- - - - - - (Phi - OF) OF J. Gibbons The add action is disabled Watch List is not available @TB 4:15 PM -/- - - - - - (Bal - 1B,OF) Util P. Konerko The add action is disabled Watch List is not available @Det W, 13-9 6-Mar 1 0 1 0 0.5 (CWS - 1B) BN C. Figgins The add action is disabled Watch List is not available -/- - - - - - (LAA - 2B,3B,OF) BN Mi. Sweeney The add action is disabled Watch List is not available @NYY L, 9-3 -/- - - - - - (KC - 1B) DL A. Huff The add action is disabled Watch List is not available Bal 4:15 PM -/- - - - - - (TB - 1B,3B,OF) DL Pitching Pos Pitchers Action Opp Status IP W SV K ERA WHIP SP F. Hernández The add action is disabled Watch List is not available ^@Cle 4:05 PM - - - - - - (Sea - SP) SP A. Pettitte The add action is disabled Watch List is not available @SF,@SF Bot 7, 1-3; 6:05 pm - - - - - - (Hou - SP) RP E. Guardado The add action is disabled Watch List is not available @Cle 4:05 PM - - - - - - (Sea - RP) RP Z. Day The add action is disabled Watch List is not available @Ari 6:40 PM - - - - - - (Col - SP,RP) P J. Patterson The add action is disabled Watch List is not available NYM L, 13-4 - - - - - - (Was - SP) P J. Westbrook The add action is disabled Watch List is not available Sea 4:05 PM - - - - - - (Cle - SP) P B. Arroyo The add action is disabled Watch List is not available @ChC W, 8-3 - - - - - - (Cin - SP) BN D. Haren The add action is disabled Watch List is not available @Min L, 8-2 - - - - - - (Oak - SP) BN E. Santana The add action is disabled Watch List is not available - - - - - - (LAA - SP) -- dok112 ------------------------------------------------------------------------ dok112's Profile: http://www.excelforum.com/member.php...o&userid=10581 View this thread: http://www.excelforum.com/showthread...hreadid=532458 |
Cant query a web page
It must be an Excel 2000 thing.
|
All times are GMT +1. The time now is 08:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com