PC Review


Reply
 
 
geebee
Guest
Posts: n/a
 
      15th Sep 2008
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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
change ctl+click to click to follow a link? rallen Microsoft Outlook Discussion 1 1st Mar 2010 06:49 PM
PDF Link: Click link: Open option: File doesn't exist Mekon Mike Windows XP Internet Explorer 1 25th Jun 2008 03:43 PM
i click on a link it it wont open.It Come up with locate link Bro Brett Windebank Microsoft Outlook Discussion 0 21st Feb 2008 08:30 PM
I can no longer click (ctrl + click on a web link) in Word 2003. =?Utf-8?B?bWVkaWFndXk=?= Microsoft Word Document Management 1 27th Jul 2006 10:52 PM
Click on a link and a picture loads in cell depending on which link you have clicked gatesheadthunde Microsoft Excel Discussion 7 13th Jun 2004 03:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:31 AM.