click LINK

G

geebee

hi,

i have the following which simply open up AOL.com in a web browser:

Option Explicit
Dim THandle As Long
Private Declare Function BringWindowToTop Lib "user32" (ByVal _
hwnd As Long) As Long

Private Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long

Private Declare Function ShowWindow _
Lib "user32" _
(ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long

Private Const SW_SHOWNORMAL = 1
Private Const SW_SHOWMINIMIZED = 2
Private Const SW_SHOWMAXIMIZED = 3


Dim myIE As New InternetExplorer

Sub gg()

Dim myIE As New InternetExplorer 'New '
Dim myURL As String

'Dim myDoc As HTMLDocument

'Set starting URL and search string
myURL = "http://www.aol.com"

'Make IE navigate to the URL and make browser visible
myIE.navigate myURL
myIE.Visible = True


'******************************************************
'put the focus on the IE window/ePremis, and simulate hitting ENTER key
'note because this code puts the focus on the IE application/window,
'you cannot step through the code to see it work. you have to RUN the code
'******************************************************
Dim lHwnd As Long
lHwnd = FindWindow("IEFrame", vbNullString) 'determine if there is IE open

'MsgBox Windows.Application

If lHwnd <> 0 Then
'MsgBox "IE is open!", vbInformation, "IE"
MsgBox "IE is open"
ShowWindow lHwnd, SW_SHOWNORMAL
Dim XT As Long
XT = BringWindowToTop(lHwnd) 'brings the IE window to top
****INSERT HERE*** ??????

Else
MsgBox "IE isn't open!", vbInformation, "Window not found."
End If
'******************************************************
'end of put the focus on the IE window/ePremis, and simulate hitting ENTER key
'******************************************************


End Sub



I am trying to figure out how to put the following code somewhere in the
preceding (somewhere in the ****INSERT HERE*** section i am guessing it would
go. this code simulates clicking the "Food" link within AOL.com website.
please not that i do not want to open up a new browser window. i simply want
to click the link in the already opened web browser window...



Private Sub teeter()

Dim o2
Set o2 = CreateObject("internetexplorer.application")
o2.navigate "http://www.aol.com "
o2.Visible = True
While o2.Busy: DoEvents: Wend
Set o = o2.document.All.tags("A")
M = o.Length: mySubmit = -1
For r = 0 To M - 1: zz = ""
zz = zz & "Link Index : " & r & " of " & o.Length - 1
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . tabindex : " & o.Item(r).TabIndex
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . tagname : " & o.Item(r).tagname
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . href : " & o.Item(r).href
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . type : " & o.Item(r).Type
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . name : " & o.Item(r).Name
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . innerhtml : " & o.Item(r).innerhtml
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . outerhtml : " & o.Item(r).outerhtml
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . rel : " & o.Item(r).rel
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . rev : " & o.Item(r).rev
zz = zz & String(3, vbCrLf)
'
zz = zz & "A . id : " & o.Item(r).ID
zz = zz & String(3, vbCrLf)
'MsgBox zz
If InStr(1, o.Item(r).innerhtml, "Food", vbTextCompare) Then
'MsgBox "= F O U N D =" & vbCrLf & o.Item(r).innerhtml
o.Item(r).Click: Exit For
End If
Next
' o2.Quit
' Set o2 = Nothing
End Sub

any help would GREATLY be appreciated...


thanks in advance,
geebee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top