Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Navigation
New to automating some IE navigation within excel VBE, I've searched a
variety of forums already, and found little code example for navigating web pages I just need a little boost. The following code works great for opening a webpage automatically. IN this example, it opens Mapquest. However, I have no idea how to set the code to select variuos things on the web page and enter data, etc. Could someone provide an example of how to enter some data into this webpage in the map section and have it select the get map option? I can work off of that and modify to suit my needs, I just need a tiny example of some web page navigation, selecting things on a web page, etc, so I can see what the code looks like. THANKS!!!!! Dim IE As InternetExplorer Set IE = New InternetExplorer IE.Navigate URL:="http://www.mapquest.com/" IE.Visible = True Do While IE.Busy Or Not IE.ReadyState = _ READYSTATE_COMPLETE DoEvents Loop MsgBox IE.Document.body.innerText IE.Quit Set IE = Nothing |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Navigation
Below is some example code. CCCC is the name of a input box on that page....
HTH, Bernie MS Excel MVP Sub GETTAF() Dim IE Dim IPF ' Prepare to open the web page Set IE = CreateObject("InternetExplorer.Application") With IE .Visible = True .Navigate "http://weather.noaa.gov/weather/shorttaf.shtml" ' Loop until the page is fully loaded Do Until Not .Busy DoEvents Loop ' Make the desired selections on the web page and click the submitButton Set IPF = IE.Document.all.Item("CCCC") IPF.Value = "LEVC" Set IPF = IE.Document.all.Item("SUBMIT") IPF.Value = "submit" IPF.Click ' Loop until the page is fully loaded Do Until Not .Busy DoEvents Loop End With Sheets("sheet1").Cells(1, "A").Value = IE.Document.body.innerText ' Close the internet explorer application With IE .Visible = True End With IE.Quit End Sub "bodhisatvaofboogie" wrote in message ... New to automating some IE navigation within excel VBE, I've searched a variety of forums already, and found little code example for navigating web pages I just need a little boost. The following code works great for opening a webpage automatically. IN this example, it opens Mapquest. However, I have no idea how to set the code to select variuos things on the web page and enter data, etc. Could someone provide an example of how to enter some data into this webpage in the map section and have it select the get map option? I can work off of that and modify to suit my needs, I just need a tiny example of some web page navigation, selecting things on a web page, etc, so I can see what the code looks like. THANKS!!!!! Dim IE As InternetExplorer Set IE = New InternetExplorer IE.Navigate URL:="http://www.mapquest.com/" IE.Visible = True Do While IE.Busy Or Not IE.ReadyState = _ READYSTATE_COMPLETE DoEvents Loop MsgBox IE.Document.body.innerText IE.Quit Set IE = Nothing |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Navigation
That is pretty great, I appreciate that THANKS!!!
Now, how did you know that the input box was named CCCC? Is there something hidden that I can look up to get ahold of that information for a web page? Thanks!!! "Bernie Deitrick" wrote: Below is some example code. CCCC is the name of a input box on that page.... HTH, Bernie MS Excel MVP Sub GETTAF() Dim IE Dim IPF ' Prepare to open the web page Set IE = CreateObject("InternetExplorer.Application") With IE .Visible = True .Navigate "http://weather.noaa.gov/weather/shorttaf.shtml" ' Loop until the page is fully loaded Do Until Not .Busy DoEvents Loop ' Make the desired selections on the web page and click the submitButton Set IPF = IE.Document.all.Item("CCCC") IPF.Value = "LEVC" Set IPF = IE.Document.all.Item("SUBMIT") IPF.Value = "submit" IPF.Click ' Loop until the page is fully loaded Do Until Not .Busy DoEvents Loop End With Sheets("sheet1").Cells(1, "A").Value = IE.Document.body.innerText ' Close the internet explorer application With IE .Visible = True End With IE.Quit End Sub "bodhisatvaofboogie" wrote in message ... New to automating some IE navigation within excel VBE, I've searched a variety of forums already, and found little code example for navigating web pages I just need a little boost. The following code works great for opening a webpage automatically. IN this example, it opens Mapquest. However, I have no idea how to set the code to select variuos things on the web page and enter data, etc. Could someone provide an example of how to enter some data into this webpage in the map section and have it select the get map option? I can work off of that and modify to suit my needs, I just need a tiny example of some web page navigation, selecting things on a web page, etc, so I can see what the code looks like. THANKS!!!!! Dim IE As InternetExplorer Set IE = New InternetExplorer IE.Navigate URL:="http://www.mapquest.com/" IE.Visible = True Do While IE.Busy Or Not IE.ReadyState = _ READYSTATE_COMPLETE DoEvents Loop MsgBox IE.Document.body.innerText IE.Quit Set IE = Nothing |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Navigation
Alright, I found the name of the box in the souce code. However, on some web
pages, it's not so distinct as to have that name = ** When looking at the code for java script, how would one locate the name of a link to have the macro click? tabindex = \"0\"\r\n id = \"NB_IDENTIFY_CUSTOMER\"\r\n onClick = \"if(!handleTransLaunch()){return false;} go(this,\'IDENTIFY_CUSTOMER\',\'IDENTIFY_CUSTOMER\ ');return false;\"\r\n <a href=\"#\" tabindex=\"-1\"Identify Account</a\r\n </td\r\n\r\n </tr\r\n\r\n\r\n\r\n <tr\r\n <td class = \"nb\"\r\n This is an example of some of the info related to a link to have it click this link, I assumed I'd go with the id, that didn't work....I tried to just plug away into the macro using: Set IPF = IE.Document.all.Item("NB_IDENTIFY_CUSTOMER") IPF.Value = "NB_IDENTIFY_CUSTOMER" IPF.Click of course that failed, because I'm not familiar with all this web stuff. Any advice would be GREAT!!! thanks!!! "Bernie Deitrick" wrote: Below is some example code. CCCC is the name of a input box on that page.... HTH, Bernie MS Excel MVP Sub GETTAF() Dim IE Dim IPF ' Prepare to open the web page Set IE = CreateObject("InternetExplorer.Application") With IE .Visible = True .Navigate "http://weather.noaa.gov/weather/shorttaf.shtml" ' Loop until the page is fully loaded Do Until Not .Busy DoEvents Loop ' Make the desired selections on the web page and click the submitButton Set IPF = IE.Document.all.Item("CCCC") IPF.Value = "LEVC" Set IPF = IE.Document.all.Item("SUBMIT") IPF.Value = "submit" IPF.Click ' Loop until the page is fully loaded Do Until Not .Busy DoEvents Loop End With Sheets("sheet1").Cells(1, "A").Value = IE.Document.body.innerText ' Close the internet explorer application With IE .Visible = True End With IE.Quit End Sub "bodhisatvaofboogie" wrote in message ... New to automating some IE navigation within excel VBE, I've searched a variety of forums already, and found little code example for navigating web pages I just need a little boost. The following code works great for opening a webpage automatically. IN this example, it opens Mapquest. However, I have no idea how to set the code to select variuos things on the web page and enter data, etc. Could someone provide an example of how to enter some data into this webpage in the map section and have it select the get map option? I can work off of that and modify to suit my needs, I just need a tiny example of some web page navigation, selecting things on a web page, etc, so I can see what the code looks like. THANKS!!!!! Dim IE As InternetExplorer Set IE = New InternetExplorer IE.Navigate URL:="http://www.mapquest.com/" IE.Visible = True Do While IE.Busy Or Not IE.ReadyState = _ READYSTATE_COMPLETE DoEvents Loop MsgBox IE.Document.body.innerText IE.Quit Set IE = Nothing |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Navigation | Excel Worksheet Functions | |||
navigation | Excel Discussion (Misc queries) | |||
Navigation | Excel Discussion (Misc queries) | |||
Navigation | Excel Worksheet Functions | |||
Navigation help please | New Users to Excel |