Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default 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   Report Post  
Posted to microsoft.public.excel.programming
r r is offline
external usenet poster
 
Posts: 125
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Page of a MultiPage Geoff Excel Programming 3 November 15th 06 09:56 AM
Select Multipage by name? Julian[_4_] Excel Programming 4 September 10th 06 03:14 PM
Userform, multipage, select a tab Jos Vens[_2_] Excel Programming 2 February 28th 05 04:11 PM
How do I set the focus to a page in a multipage Azza Excel Programming 2 November 23rd 04 10:42 PM
how to put a reference from a page of a multipage form to another page Valeria[_2_] Excel Programming 2 January 25th 04 08:21 AM


All times are GMT +1. The time now is 04:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"