View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default 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