M
mjack003
I have pulled all my hair out. I've never had a problem automating IE
until now. This is the code I have which fills out a form on my
company's intranet, submits the values, then searches for the named
table, selects it, and pulls the data I need. The problem I have is
this particular page has two tables that have the same name and ID. I
need to select the second table of the two. I have tried creating a
HTMLElementCollection of the document and looping through the items
until I reach the table I need but keep getting a type mismatch error
when trying to set my collection = mypageHTML.all. If anyone has a
better method I'd appreciate the input or some clarification on how to
populate the ElementCollection.
Best Regards,
Mjack
Application.ScreenUpdating = False
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate "http://blahblah/cgi-bin/blahblah_blahblah.pl"
Do Until ie.readyState = READYSTATE_COMPLETE: DoEvents: Loop
With ie.document.forms("F001")
..project_id_pulldown.Value = 646
..xl_or_html.Value = "HTML"
..output_format.Value = "ALL"
..submit
End With
Do Until ie.readyState = READYSTATE_COMPLETE: DoEvents: Loop
Set myPageHtml = ie.document
Set elemColl = myPageHtml.all
Set tr = myPageHtml.body.createTextRange
'Set tbl = myPageHtml.getElementById("<tablename>")
'tr.moveToElementText (tbl)
tr.Select
tr.execCommand ("copy")
until now. This is the code I have which fills out a form on my
company's intranet, submits the values, then searches for the named
table, selects it, and pulls the data I need. The problem I have is
this particular page has two tables that have the same name and ID. I
need to select the second table of the two. I have tried creating a
HTMLElementCollection of the document and looping through the items
until I reach the table I need but keep getting a type mismatch error
when trying to set my collection = mypageHTML.all. If anyone has a
better method I'd appreciate the input or some clarification on how to
populate the ElementCollection.
Best Regards,
Mjack
Application.ScreenUpdating = False
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate "http://blahblah/cgi-bin/blahblah_blahblah.pl"
Do Until ie.readyState = READYSTATE_COMPLETE: DoEvents: Loop
With ie.document.forms("F001")
..project_id_pulldown.Value = 646
..xl_or_html.Value = "HTML"
..output_format.Value = "ALL"
..submit
End With
Do Until ie.readyState = READYSTATE_COMPLETE: DoEvents: Loop
Set myPageHtml = ie.document
Set elemColl = myPageHtml.all
Set tr = myPageHtml.body.createTextRange
'Set tbl = myPageHtml.getElementById("<tablename>")
'tr.moveToElementText (tbl)
tr.Select
tr.execCommand ("copy")