Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
page select in multipage web site
Hi All, I have a multipage web site, where Set coursetables = IE.document.getElementsByTagname("table") and after that ?coursetables.Item(16).Rows(0).Cells(0).innertext returns Page 1 of 2 Previous Page | Next Page On the web page clicking manually on Next Page bring up the next page. How can I find the object that can be clicked on in VBA (like clicking on a button is done via myButton.click) to bring up the next page? Thanks, Stefi |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
page select in multipage web site
you may show the address to analyze the html? ... I normally watch the address on his change from one page to another and browsing again regards r an example in Italian: http://excelvba.altervista.org/blog/...re-il-Web.html Il mio ultimo lavoro ... http://excelvba.altervista.org/blog/...ternative.html "Stefi" wrote: Hi All, I have a multipage web site, where Set coursetables = IE.document.getElementsByTagname("table") and after that ?coursetables.Item(16).Rows(0).Cells(0).innertext returns Page 1 of 2 Previous Page | Next Page On the web page clicking manually on Next Page bring up the next page. How can I find the object that can be clicked on in VBA (like clicking on a button is done via myButton.click) to bring up the next page? Thanks, Stefi |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
page select in multipage web site
I did a search on goolge to get a multi-page results and got this code. I won't guarentee it will work in your case but it will give you an example. I searched for the ID=nav to get the navigation object and then created a new URL. I found that hoovering over the NEXT button showed the same results as the NAV property. Sub Macro3() ' Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True URL = "http://www.google.com/" Search = "search?hl=en&q=joel&aq=f&oq=&aqi=g10" Do 'get web page IE.Navigate2 URL & Search Do While IE.readyState < 4 And IE.busy = True DoEvents Loop 'put you code here Set Nextobj = IE.document.getElementByID("nav") If Not Nextobj Is Nothing Then Set NextPage = Nextobj.Cells(Nextobj.Cells.Length - 1) Search = NextPage.FirstChild.nameprop End If Loop While Not Nextobj Is Nothing End Sub "Stefi" wrote: Hi All, I have a multipage web site, where Set coursetables = IE.document.getElementsByTagname("table") and after that ?coursetables.Item(16).Rows(0).Cells(0).innertext returns Page 1 of 2 Previous Page | Next Page On the web page clicking manually on Next Page bring up the next page. How can I find the object that can be clicked on in VBA (like clicking on a button is done via myButton.click) to bring up the next page? Thanks, Stefi |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
page select in multipage web site
Thanks to both of you, r and Joel, I'm going to follow the ways you showed me. It's interesting that there is no simpler way for handling such an everyday case! Stefi €˛Joel€¯ ezt Ć*rta: I did a search on goolge to get a multi-page results and got this code. I won't guarentee it will work in your case but it will give you an example. I searched for the ID=nav to get the navigation object and then created a new URL. I found that hoovering over the NEXT button showed the same results as the NAV property. Sub Macro3() ' Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True URL = "http://www.google.com/" Search = "search?hl=en&q=joel&aq=f&oq=&aqi=g10" Do 'get web page IE.Navigate2 URL & Search Do While IE.readyState < 4 And IE.busy = True DoEvents Loop 'put you code here Set Nextobj = IE.document.getElementByID("nav") If Not Nextobj Is Nothing Then Set NextPage = Nextobj.Cells(Nextobj.Cells.Length - 1) Search = NextPage.FirstChild.nameprop End If Loop While Not Nextobj Is Nothing End Sub "Stefi" wrote: Hi All, I have a multipage web site, where Set coursetables = IE.document.getElementsByTagname("table") and after that ?coursetables.Item(16).Rows(0).Cells(0).innertext returns Page 1 of 2 Previous Page | Next Page On the web page clicking manually on Next Page bring up the next page. How can I find the object that can be clicked on in VBA (like clicking on a button is done via myButton.click) to bring up the next page? Thanks, Stefi |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
page select in multipage web site
Here is some debug code you may need. The row where I put ID in column C may
need to be commented out because not all webpages support the property ID. Look for the word Next in column D to help find the navigation object. Sub Macro3() ' Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True URL = "http://www.google.com/" Search = "search?hl=en&q=joel&aq=f&oq=&aqi=g10" 'get web page IE.Navigate2 URL & Search Do While IE.readyState < 4 And IE.busy = True DoEvents Loop 'put you code here RowCount = 1 For Each itm In IE.document.all Range("A" & RowCount) = itm.tagname Range("B" & RowCount) = itm.classname Range("C" & RowCount) = itm.ID Range("D" & RowCount) = Left(itm.innertext, 1024) RowCount = RowCount + 1 Next itm Set Nextobj = IE.document.getElementByID("nav") If Not Nextobj Is Nothing Then Set NextPage = Nextobj.Cells(Nextobj.Cells.Length - 1) Search = NextPage.FirstChild.nameprop End If End Sub "Stefi" wrote: Thanks to both of you, r and Joel, I'm going to follow the ways you showed me. It's interesting that there is no simpler way for handling such an everyday case! Stefi €˛Joel€¯ ezt Ć*rta: I did a search on goolge to get a multi-page results and got this code. I won't guarentee it will work in your case but it will give you an example. I searched for the ID=nav to get the navigation object and then created a new URL. I found that hoovering over the NEXT button showed the same results as the NAV property. Sub Macro3() ' Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True URL = "http://www.google.com/" Search = "search?hl=en&q=joel&aq=f&oq=&aqi=g10" Do 'get web page IE.Navigate2 URL & Search Do While IE.readyState < 4 And IE.busy = True DoEvents Loop 'put you code here Set Nextobj = IE.document.getElementByID("nav") If Not Nextobj Is Nothing Then Set NextPage = Nextobj.Cells(Nextobj.Cells.Length - 1) Search = NextPage.FirstChild.nameprop End If Loop While Not Nextobj Is Nothing End Sub "Stefi" wrote: Hi All, I have a multipage web site, where Set coursetables = IE.document.getElementsByTagname("table") and after that ?coursetables.Item(16).Rows(0).Cells(0).innertext returns Page 1 of 2 Previous Page | Next Page On the web page clicking manually on Next Page bring up the next page. How can I find the object that can be clicked on in VBA (like clicking on a button is done via myButton.click) to bring up the next page? Thanks, Stefi |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
page select in multipage web site
Thanks, Joel! By the way, where can I find some description of these
web-handling statements (Navigate2, getElementByID, getElementByName, etc.)? There is none in Excel VBA Help! Stefi €˛Stefi€¯ ezt Ć*rta: Thanks to both of you, r and Joel, I'm going to follow the ways you showed me. It's interesting that there is no simpler way for handling such an everyday case! Stefi €˛Joel€¯ ezt Ć*rta: I did a search on goolge to get a multi-page results and got this code. I won't guarentee it will work in your case but it will give you an example. I searched for the ID=nav to get the navigation object and then created a new URL. I found that hoovering over the NEXT button showed the same results as the NAV property. Sub Macro3() ' Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True URL = "http://www.google.com/" Search = "search?hl=en&q=joel&aq=f&oq=&aqi=g10" Do 'get web page IE.Navigate2 URL & Search Do While IE.readyState < 4 And IE.busy = True DoEvents Loop 'put you code here Set Nextobj = IE.document.getElementByID("nav") If Not Nextobj Is Nothing Then Set NextPage = Nextobj.Cells(Nextobj.Cells.Length - 1) Search = NextPage.FirstChild.nameprop End If Loop While Not Nextobj Is Nothing End Sub "Stefi" wrote: Hi All, I have a multipage web site, where Set coursetables = IE.document.getElementsByTagname("table") and after that ?coursetables.Item(16).Rows(0).Cells(0).innertext returns Page 1 of 2 Previous Page | Next Page On the web page clicking manually on Next Page bring up the next page. How can I find the object that can be clicked on in VBA (like clicking on a button is done via myButton.click) to bring up the next page? Thanks, Stefi |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
page select in multipage web site
Do a search at microsoft.com for getElementByID
"Stefi" wrote: Thanks, Joel! By the way, where can I find some description of these web-handling statements (Navigate2, getElementByID, getElementByName, etc.)? There is none in Excel VBA Help! Stefi €˛Stefi€¯ ezt Ć*rta: Thanks to both of you, r and Joel, I'm going to follow the ways you showed me. It's interesting that there is no simpler way for handling such an everyday case! Stefi €˛Joel€¯ ezt Ć*rta: I did a search on goolge to get a multi-page results and got this code. I won't guarentee it will work in your case but it will give you an example. I searched for the ID=nav to get the navigation object and then created a new URL. I found that hoovering over the NEXT button showed the same results as the NAV property. Sub Macro3() ' Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True URL = "http://www.google.com/" Search = "search?hl=en&q=joel&aq=f&oq=&aqi=g10" Do 'get web page IE.Navigate2 URL & Search Do While IE.readyState < 4 And IE.busy = True DoEvents Loop 'put you code here Set Nextobj = IE.document.getElementByID("nav") If Not Nextobj Is Nothing Then Set NextPage = Nextobj.Cells(Nextobj.Cells.Length - 1) Search = NextPage.FirstChild.nameprop End If Loop While Not Nextobj Is Nothing End Sub "Stefi" wrote: Hi All, I have a multipage web site, where Set coursetables = IE.document.getElementsByTagname("table") and after that ?coursetables.Item(16).Rows(0).Cells(0).innertext returns Page 1 of 2 Previous Page | Next Page On the web page clicking manually on Next Page bring up the next page. How can I find the object that can be clicked on in VBA (like clicking on a button is done via myButton.click) to bring up the next page? Thanks, Stefi |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
page select in multipage web site
Thanks, I'll do that.
€˛Joel€¯ ezt Ć*rta: Do a search at microsoft.com for getElementByID "Stefi" wrote: Thanks, Joel! By the way, where can I find some description of these web-handling statements (Navigate2, getElementByID, getElementByName, etc.)? There is none in Excel VBA Help! Stefi €˛Stefi€¯ ezt Ć*rta: Thanks to both of you, r and Joel, I'm going to follow the ways you showed me. It's interesting that there is no simpler way for handling such an everyday case! Stefi €˛Joel€¯ ezt Ć*rta: I did a search on goolge to get a multi-page results and got this code. I won't guarentee it will work in your case but it will give you an example. I searched for the ID=nav to get the navigation object and then created a new URL. I found that hoovering over the NEXT button showed the same results as the NAV property. Sub Macro3() ' Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True URL = "http://www.google.com/" Search = "search?hl=en&q=joel&aq=f&oq=&aqi=g10" Do 'get web page IE.Navigate2 URL & Search Do While IE.readyState < 4 And IE.busy = True DoEvents Loop 'put you code here Set Nextobj = IE.document.getElementByID("nav") If Not Nextobj Is Nothing Then Set NextPage = Nextobj.Cells(Nextobj.Cells.Length - 1) Search = NextPage.FirstChild.nameprop End If Loop While Not Nextobj Is Nothing End Sub "Stefi" wrote: Hi All, I have a multipage web site, where Set coursetables = IE.document.getElementsByTagname("table") and after that ?coursetables.Item(16).Rows(0).Cells(0).innertext returns Page 1 of 2 Previous Page | Next Page On the web page clicking manually on Next Page bring up the next page. How can I find the object that can be clicked on in VBA (like clicking on a button is done via myButton.click) to bring up the next page? Thanks, Stefi |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
page select in multipage web site
Hi Joel, I tried to follow the technique you suggested, but it failed at the website I work on. Set Nextobj = IE.document.getElementByID("nav") returned Nothing because there was no "nav" element. Your debugging code gave this result of the table rows in question: A D TABLE "Page 1 of 2 Previous Page | Next Page " TBODY "Page 1 of 2 Previous Page | Next Page " TR "Page 1 of 2 Previous Page | Next Page " TD "Page 1 of 2 Previous Page | Next Page " B Page 1 of 2 BR SPAN Previous Page A Next Page B Next Page (B,C are empty, in your example column C contained "nav") The actual website is URL = "http://schedule.msu.edu/" I'm interested not in the content of this particular website but the paging technique in such cases. Thanks, Stefi €˛Joel€¯ ezt Ć*rta: Here is some debug code you may need. The row where I put ID in column C may need to be commented out because not all webpages support the property ID. Look for the word Next in column D to help find the navigation object. Sub Macro3() ' Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True URL = "http://www.google.com/" Search = "search?hl=en&q=joel&aq=f&oq=&aqi=g10" 'get web page IE.Navigate2 URL & Search Do While IE.readyState < 4 And IE.busy = True DoEvents Loop 'put you code here RowCount = 1 For Each itm In IE.document.all Range("A" & RowCount) = itm.tagname Range("B" & RowCount) = itm.classname Range("C" & RowCount) = itm.ID Range("D" & RowCount) = Left(itm.innertext, 1024) RowCount = RowCount + 1 Next itm Set Nextobj = IE.document.getElementByID("nav") If Not Nextobj Is Nothing Then Set NextPage = Nextobj.Cells(Nextobj.Cells.Length - 1) Search = NextPage.FirstChild.nameprop End If End Sub "Stefi" wrote: Thanks to both of you, r and Joel, I'm going to follow the ways you showed me. It's interesting that there is no simpler way for handling such an everyday case! Stefi €˛Joel€¯ ezt Ć*rta: I did a search on goolge to get a multi-page results and got this code. I won't guarentee it will work in your case but it will give you an example. I searched for the ID=nav to get the navigation object and then created a new URL. I found that hoovering over the NEXT button showed the same results as the NAV property. Sub Macro3() ' Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True URL = "http://www.google.com/" Search = "search?hl=en&q=joel&aq=f&oq=&aqi=g10" Do 'get web page IE.Navigate2 URL & Search Do While IE.readyState < 4 And IE.busy = True DoEvents Loop 'put you code here Set Nextobj = IE.document.getElementByID("nav") If Not Nextobj Is Nothing Then Set NextPage = Nextobj.Cells(Nextobj.Cells.Length - 1) Search = NextPage.FirstChild.nameprop End If Loop While Not Nextobj Is Nothing End Sub "Stefi" wrote: Hi All, I have a multipage web site, where Set coursetables = IE.document.getElementsByTagname("table") and after that ?coursetables.Item(16).Rows(0).Cells(0).innertext returns Page 1 of 2 Previous Page | Next Page On the web page clicking manually on Next Page bring up the next page. How can I find the object that can be clicked on in VBA (like clicking on a button is done via myButton.click) to bring up the next page? Thanks, Stefi |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Delete Page of a MultiPage | Excel Programming | |||
Select Multipage by name? | Excel Programming | |||
Userform, multipage, select a tab | Excel Programming | |||
How do I set the focus to a page in a multipage | Excel Programming | |||
how to put a reference from a page of a multipage form to another page | Excel Programming |