LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Integrating browser with excel

I changed this part of the code

Set tt = IE.document.getElementsByTagName("TABLE")
Set t = tt(0)
Debug.Print t.Rows(0).Cells(1).innerhtml

with this one

Set tt = IE.document.getElementsByTagName("TABLE")

With tt(8)
Debug.Print .Rows(4).Cells(1).innerText
End With

and it worked.

Did not use "set t = tt(x)" at all.

When I looked at the error "Object variable or With block variable not
set", I thought lets see what happens if I put a With and EndWith.
Researched a bit and got it to work finally.

Thank you very much for your support.

I want to ask one more question:
Without doing the above things, is it DIRECTLY possible to find a
string "Report Owner" in the page report1.htm and send the string of
its adjacent cell to clipboard so that it can be pasted in Excel?


On Jun 16, 9:39 pm, "Tim Williams" <timjwilliams at gmail dot com
wrote:
Can you post the source of the page you're working with?
If you don't want to show it here then you can send it to me at

tim j williams at gmail dot com (no spaces in the final address)

Tim

"Maxi" wrote in message

ups.com...



It is now going over my head.


When I put set t = tt(0) then I get <FORM action=/report.aspx
method=get<INPUT type=hidden value=box name=samp <INPUT type=hidden
and blah blah till </FORM as the output of debug.print


When I put set t = tt(1) or any number greater than zero, I get and
error "Run-time error '91 in the line Object variable or With block
variable not set" Debug.Print t.Rows(0).Cells(1).innerhtml


What am I doing wrong?


Here is the full code


Sub Tester()


Dim IE As Object
Dim tt, t


Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "http://www.mywebsite.com/"
Do While IE.ReadyState < 4
DoEvents
Loop


With IE.document.all
.Email.Value = "myusername"
.Passwd.Value = "mypassword"
.btn.Click
End With


Do While IE.ReadyState < 4
DoEvents
Loop


IE.Navigate "http://www.mywebsite.com/report1.htm"


Do While IE.ReadyState < 4
DoEvents
Loop


Set tt = IE.document.getElementsByTagName("TABLE")
Set t = tt(0)
Debug.Print t.Rows(0).Cells(1).innerhtml


End Sub


*************


Or is it possible to find a string "Report Owner" in the page
report1.htm, identify which table the string is in, and then copy the
value given in the right hand side cell of the cell where the string
"Report Owner" is found and put that value in cell G1?


Sorry, I am asking too much but I am really confused as I am doing it
for the first time.
*************


On Jun 16, 7:03 am, "Tim Williams" <timjwilliams at gmail dot com
wrote:
1. If all of the pages have the same structure then you should be able
to
get to the table like this


dim tt, t
set tt = IE.document.getElementsByTagName("TABLE")
set t = tt(x)


Where x is the number of the table (starts at 0, so experiment a bit to
find
the table you want)


then try


debug.print t.rows(0).cells(1).innerHTML 'row 1 col 2
..etc to find the values you need
note: rows() and cells() are also zero-based- Hide quoted text -


- Show quoted text -



 
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
Integrating Excel with Windows Security Paul Kraemer Excel Discussion (Misc queries) 1 March 26th 10 06:06 PM
Integrating pictures in an excel document Mag Gam Excel Discussion (Misc queries) 2 March 9th 07 12:53 PM
Integrating Outlook, Word, Excel macros Mike Excel Programming 4 February 26th 06 06:53 PM
Integrating Excel with Access Kenard Excel Discussion (Misc queries) 1 April 3rd 05 08:57 PM
Problems integrating Excel VBA application with frontpage Sojee Excel Programming 0 April 20th 04 10:06 AM


All times are GMT +1. The time now is 07:38 PM.

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

About Us

"It's about Microsoft Excel"