Home |
Search |
Today's Posts |
#12
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Integrating Excel with Windows Security | Excel Discussion (Misc queries) | |||
Integrating pictures in an excel document | Excel Discussion (Misc queries) | |||
Integrating Outlook, Word, Excel macros | Excel Programming | |||
Integrating Excel with Access | Excel Discussion (Misc queries) | |||
Problems integrating Excel VBA application with frontpage | Excel Programming |