View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default ID and access currently active web page (in IE6)?


Sounds like you have to login with a username and password. See this sample
code (I got it from this DG a short time ago):

Sub Login()

'This gets rid of the duplicate data
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

HomeURL = "http://www.countrybobsdemo.com/administrator/"

'get web page
IE.Navigate2 HomeURL
Do While IE.readyState < 4
DoEvents
Loop

Do While IE.busy = True
DoEvents
Loop
Set Form = IE.document.getelementsbytagname("Form")

Set NameBox = IE.document.getElementById("modlgn_username")
'check if already login
If Not NameBox Is Nothing Then
NameBox.Value = "Ryan"

Set PasswordBox = IE.document.getElementById("modlgn_passwd")
PasswordBox.Value = "ryan123"

Form(0).submit
Do While IE.busy = True
DoEvents
Loop
End If

URL = "index.php?option=com_rsform&task=submissions.mana ge&formId=2"

'get web page
IE.Navigate2 HomeURL & URL
Do While IE.readyState < 4
DoEvents
Loop

Do While IE.busy = True
DoEvents
Loop

Set Mytables = IE.document.getelementsbytagname("table")

Set History = Mytables(2)

RowCount = 1
For Each itm In History.Rows
ColCount = 1
For Each Col In itm.Cells
Select Case Col.Children.Length

Case 0, 1, 2
Cells(RowCount, ColCount) = Col.innertext
Case Is = 3
Cells(RowCount, ColCount) = Col.Children(1).innertext
End Select

ColCount = ColCount + 1
Next Col

RowCount = RowCount + 1
Next itm
End Sub


HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"ker_01" wrote:

I googled, but no joy. Using Excel 2003.

I have other code I've used to navigate, open, and parse web pages- but all
from within Excel, it never popped up in IE. However, now I need to parse a
page that I can't open directly from Excel (I have to enter a screen-based
code to go from page to page). So, I'd like to be able to manually navigate
in IE, then run my macro to scrape the key elements from the IE web page and
bring them into my target worksheet range.

Can anyone help me with the syntax to point Excel to the currently active IE
page?

Thank you,
Keith