Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping Web Query
This one might not be possible, but I thought I would try.
I want to analize some data in excel that is taken off the web but first I need to inport the data into one master database. My problem is that I need to inport roughtly 55-60 different pieces or files of info and each piece of info is linked to another web address "Hyperlinded". I have the Web address (located in cell A1) I need to go to start with and also a list of names (located in Cells A2:A60) that I need to click on to get the appropriate info. How can I tell the web query to goto this particular wed site find the first name in cell A2 open that new address and inport a particular chart in the first avalilbe cell in coloum C? I have tried recording this and inserting loop statment to keep going but it just doesn't work for me. Any help or guidance is appreciated. Best regards, Pete |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping Web Query
|
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping Web Query
Here is what I got so far...
Range("C1").Select With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://sports.espn.go.com/nfl/players? league=nfl", _ Destination:=Range("C1")) .Name = Range("A1") .WebTables = "2,5" End With Not much I know... but it shows where I am with this. Range A1 has the player name in it. Cell C1 is where I wnt the info to go for that particular player. The info I bring in just happens to take up 13 cells straight down. Pete -----Original Message----- More info along with your macro and urls for comments -- Don Guillett SalesAid Software "Pete" wrote in message ... This one might not be possible, but I thought I would try. I want to analize some data in excel that is taken off the web but first I need to inport the data into one master database. My problem is that I need to inport roughtly 55-60 different pieces or files of info and each piece of info is linked to another web address "Hyperlinded". I have the Web address (located in cell A1) I need to go to start with and also a list of names (located in Cells A2:A60) that I need to click on to get the appropriate info. How can I tell the web query to goto this particular wed site find the first name in cell A2 open that new address and inport a particular chart in the first avalilbe cell in coloum C? I have tried recording this and inserting loop statment to keep going but it just doesn't work for me. Any help or guidance is appreciated. Best regards, Pete . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping Web Query
http://sports.espn.go.com/nfl/players?search=henson
this is what I got when I ask for romo. Apparently you can't get first names or ID? http://sports.espn.go.com/nfl/players?search=henson http://sports.espn.go.com/nfl/player...atsId=6624&out So you would have to create a list and loop through the list of last names unless you can get the ID number for each player. http://sports.espn.go.com/nfl/players?search=henson http://sports.espn.go.com/nfl/player...atsId=6624&out henson romo glenn etc sort of like this. I did not test for each name in [mylist] "url;http://sports.espn.go.com/nfl/players?search="& name,Destination:=Range("C1")) next name -- Don Guillett SalesAid Software "Pete" wrote in message ... Here is what I got so far... Range("C1").Select With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://sports.espn.go.com/nfl/players? league=nfl", _ Destination:=Range("C1")) .Name = Range("A1") .WebTables = "2,5" End With Not much I know... but it shows where I am with this. Range A1 has the player name in it. Cell C1 is where I wnt the info to go for that particular player. The info I bring in just happens to take up 13 cells straight down. Pete -----Original Message----- More info along with your macro and urls for comments -- Don Guillett SalesAid Software "Pete" wrote in message ... This one might not be possible, but I thought I would try. I want to analize some data in excel that is taken off the web but first I need to inport the data into one master database. My problem is that I need to inport roughtly 55-60 different pieces or files of info and each piece of info is linked to another web address "Hyperlinded". I have the Web address (located in cell A1) I need to go to start with and also a list of names (located in Cells A2:A60) that I need to click on to get the appropriate info. How can I tell the web query to goto this particular wed site find the first name in cell A2 open that new address and inport a particular chart in the first avalilbe cell in coloum C? I have tried recording this and inserting loop statment to keep going but it just doesn't work for me. Any help or guidance is appreciated. Best regards, Pete . |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping Web Query
Don, this VBA returns a complied error stating "Next
without For". I named my list of last names as "myList" Range "A2:A60". Sub WebQ() For Each Name In myList With ActiveSheet.QueryTables.Add(Connection:= _ "url;http://sports.espn.go.com/nfl/players?search=" & _ Name, Destination:=Range("C1")) Next Name End Sub Also if we do get this to work, won't it keep inserting the data retrived from the web in cell C1? Any thoughts Pete -----Original Message----- http://sports.espn.go.com/nfl/players?search=henson this is what I got when I ask for romo. Apparently you can't get first names or ID? http://sports.espn.go.com/nfl/players?search=henson http://sports.espn.go.com/nfl/players/profile? statsId=6624&out So you would have to create a list and loop through the list of last names unless you can get the ID number for each player. http://sports.espn.go.com/nfl/players?search=henson http://sports.espn.go.com/nfl/players/profile? statsId=6624&out henson romo glenn etc sort of like this. I did not test for each name in [mylist] "url;http://sports.espn.go.com/nfl/players?search="& name,Destination:=Range("C1")) next name -- Don Guillett SalesAid Software "Pete" wrote in message ... Here is what I got so far... Range("C1").Select With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://sports.espn.go.com/nfl/players? league=nfl", _ Destination:=Range("C1")) .Name = Range("A1") .WebTables = "2,5" End With Not much I know... but it shows where I am with this. Range A1 has the player name in it. Cell C1 is where I wnt the info to go for that particular player. The info I bring in just happens to take up 13 cells straight down. Pete -----Original Message----- More info along with your macro and urls for comments -- Don Guillett SalesAid Software "Pete" wrote in message ... This one might not be possible, but I thought I would try. I want to analize some data in excel that is taken off the web but first I need to inport the data into one master database. My problem is that I need to inport roughtly 55-60 different pieces or files of info and each piece of info is linked to another web address "Hyperlinded". I have the Web address (located in cell A1) I need to go to start with and also a list of names (located in Cells A2:A60) that I need to click on to get the appropriate info. How can I tell the web query to goto this particular wed site find the first name in cell A2 open that new address and inport a particular chart in the first avalilbe cell in coloum C? I have tried recording this and inserting loop statment to keep going but it just doesn't work for me. Any help or guidance is appreciated. Best regards, Pete . . |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping Web Query
1. You forgot that my list is a range so you need range("mylist") or
[mylist] 2. I named a sheet "Data" and used this and it worked BUT only if there was only ONE player with that last name. Otherwise, you get the list of players with that last name. I guess you would have to get the player ID and make an offset from mylist. OR??? 3. Yes, it will overwrite. You need to extract what you want from within the for/next to another sheet 4. you might want to play with the parameters such as .savedata=true Let me know how it works out. Sub WebqDon() For Each Name In [mylist] myurl = "http://sports.espn.go.com/nfl/players?search=" & Name With Sheets("Data").QueryTables.Add(Connection:="URL;" & myurl, _ Destination:=Sheets("Data").Range("c4")) .BackgroundQuery = True .TablesOnlyFromHTML = False .Refresh BackgroundQuery:=False .SaveData = True End With 'code to extract data needed to another sheet. Next Name End Sub -- Don Guillett SalesAid Software "Pete" wrote in message ... Don, this VBA returns a complied error stating "Next without For". I named my list of last names as "myList" Range "A2:A60". Sub WebQ() For Each Name In myList With ActiveSheet.QueryTables.Add(Connection:= _ "url;http://sports.espn.go.com/nfl/players?search=" & _ Name, Destination:=Range("C1")) Next Name End Sub Also if we do get this to work, won't it keep inserting the data retrived from the web in cell C1? Any thoughts Pete -----Original Message----- http://sports.espn.go.com/nfl/players?search=henson this is what I got when I ask for romo. Apparently you can't get first names or ID? http://sports.espn.go.com/nfl/players?search=henson http://sports.espn.go.com/nfl/players/profile? statsId=6624&out So you would have to create a list and loop through the list of last names unless you can get the ID number for each player. http://sports.espn.go.com/nfl/players?search=henson http://sports.espn.go.com/nfl/players/profile? statsId=6624&out henson romo glenn etc sort of like this. I did not test for each name in [mylist] "url;http://sports.espn.go.com/nfl/players?search="& name,Destination:=Range("C1")) next name -- Don Guillett SalesAid Software "Pete" wrote in message ... Here is what I got so far... Range("C1").Select With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://sports.espn.go.com/nfl/players? league=nfl", _ Destination:=Range("C1")) .Name = Range("A1") .WebTables = "2,5" End With Not much I know... but it shows where I am with this. Range A1 has the player name in it. Cell C1 is where I wnt the info to go for that particular player. The info I bring in just happens to take up 13 cells straight down. Pete -----Original Message----- More info along with your macro and urls for comments -- Don Guillett SalesAid Software "Pete" wrote in message ... This one might not be possible, but I thought I would try. I want to analize some data in excel that is taken off the web but first I need to inport the data into one master database. My problem is that I need to inport roughtly 55-60 different pieces or files of info and each piece of info is linked to another web address "Hyperlinded". I have the Web address (located in cell A1) I need to go to start with and also a list of names (located in Cells A2:A60) that I need to click on to get the appropriate info. How can I tell the web query to goto this particular wed site find the first name in cell A2 open that new address and inport a particular chart in the first avalilbe cell in coloum C? I have tried recording this and inserting loop statment to keep going but it just doesn't work for me. Any help or guidance is appreciated. Best regards, Pete . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Convert hard coded query criteria to Parameter Query | Excel Discussion (Misc queries) | |||
Excel 2007 / MS Query - editing existing query to another sheet | Excel Discussion (Misc queries) | |||
Help with macro looping and color query function | Excel Discussion (Misc queries) | |||
Web Query with looping variables in the URL | Excel Programming | |||
looping every third row | Excel Programming |