[RESOLVED] Access OO > Internet Explorer
Hi,
I can open an instance of internet explorer :
Code:
set objIE = createobject("InternetExplorer.Application")
But how do I get a reference to an already open IE ?
I tried GetObject but it complains :
Set objIE = GetObject(,"InternetExplorer.Application")
Quote:
ActiveX Component can't create object
or
Set objIE = GetObject("InternetExplorer.Application")
Quote:
Automation Error, invalid syntax
I'm sure I've done this in the past and its connected to an open IE (not forced user to re-open and browse...)
Any one have any ideas or pointers to websites to read up on this?
(I have a form on a web page and I want to get to the HTML to Parse and store into my mdb)
Re: Access OO > Internet Explorer
you can use a shell object to work with an open instance of internet explorer
Code:
set sh = createobject("shell.application")
for each w in sh.windows
' use some criteria here to determine if it is the window you are looking for
' explorer windows always are listed before IE windows
next
Re: Access OO > Internet Explorer
Hi,
Thanks. Does that get me the application or just the window?
Sorry for sounding thick, but the intellisense isn't much use in this case...
Re: Access OO > Internet Explorer
you can work with the document of the window, and the application of the document
Re: Access OO > Internet Explorer
Riiii ght ;)
Let me have a look into that and I'll get back to you when (if?) I get stuck... :)
Re: Access OO > Internet Explorer
Didn't take me too long to get stuck lol
Tried checking out some information from This MS page which hinted at things I wanted (eg to get to the html of the page showing).
For ease of use I am opening an instance of IE and navigating to the page to log in... and holding the reference to IE so I can 'see' that at least.
From there though, there doesn't appear to be any logical or useful intellisense pop ups. Including defining variables as specific objects to get the intellisense.
objie.container --- this has nothing in it/errors
objie.document --- errors
This is usually followed by Access 2010 crashing out... lovely.
Am I missing some useful references?
Edit:
Code:
?objie.Document
[object]
Re: Access OO > Internet Explorer
Last post....
When you use the shell you don't seem to get any of the internetexplorer objects/methods.
So I am going to have to force the user to open an IE from my MDb first then hold the reference to it.
This then does what I need.
Thanks for your patience and pointers.
:) :thumbs:
Re: Access OO > Internet Explorer
Quote:
Am I missing some useful references?
no references required, but if you reference html, you can use the intellisense, if you declare your variables correctly
Quote:
When you use the shell you don't seem to get any of the internetexplorer objects/methods.
just needs a little more patience to work out where the objects are
this works correctly, without error, i opened the webpage you linked to above in ie
Code:
Dim doc As HTMLDocument ' reference to html required
Set sh = CreateObject("shell.application")
Set w = sh.Windows(sh.Windows.Count - 1) ' as i only have 1 instance of ie open, it has to be the last window
'Debug.Print w.document.documentelement.innerhtml
Set doc = w.document
intellisense will work for doc as it is declared and referenced
use the locals window to find what elements can be used
Quote:
?objie.Document
[object]
shows correct result
Quote:
So I am going to have to force the user to open an IE from my MDb first then hold the reference to it.
you can do everything from the shell window
you can also reference shell automation, but beyond getting the correct window it will not help you much