GetObject equivalent for IE
'Find an IE window with matching location and get a reference
' to the document object from the loaded page. Assumes no frames.
Function GetHTMLDocument(sAddress As String) As Object
Dim objShell As Object, objShellWindows As Object, o As Object
Dim retVal As Object, sURL As String
Set retVal = Nothing
Set objShell = CreateObject("Shell.Applicatio*n")
Set objShellWindows = objShell.Windows
'see if IE is already open
For Each o In objShellWindows
sURL = ""
On Error Resume Next
sURL = o.Document.Location
On Error GoTo 0
If sURL < "" Then
If sURL Like sAddress & "*" Then
Set retVal = o.Document
Exit For
End If
End If
Next o
Set GetHTMLDocument = retVal
End Function
Tim
"spaceman" wrote in message
...
soz for double post, trying to set OE up !
"spaceman" wrote in message
...
Is there anyway/alternative method of using GetObject for Internet
Explorer?
Is there a workaround for GetObject? I saw some things yesterday
but it seemed to involve downloading something, which doesn't work
for me at work (we're not supposed to use downloaded things etc).
And IE doesn't add itself to the existing applications listing (or
whatever it's called) like programs that are associated to file
extensions - excel, word, adobe etc.
Basically, I want to target an existing IE window, the name of it
will be unique, and then from there, either copy the contents of
that web page into a cell, or be able to target a textbox on that
page called xxfundsxx (for example) to return the contents of that
textbox into a variable.
Navigating to the page and then getting the data (which I can do,
but is not possible in this situation) won't work due to it being
an IE based application that is always the same web page, but it
extracts data for different accounts etc when it is opened. Has to
be from an existing window.
Cheers.
|