Solved

VBA accessing Internet Explorer window properties

Posted on 2004-04-17
3
1,541 Views
Last Modified: 2012-06-27
I have an html page with a link directly to a PowerPoint slide show file, myfile.pps.  Clicking on the link causes a child window to open, and the slide show to open directly in the the new child IE browser window.

Once started, the presenation has a button that launches a VBA macro in the ppt.  

The parent window has information in html forms that the VBA macro needs to get.  In javascript, this is trivial.  window.parent.formname.element.value

But how do I refer to the IE window from VBA?

Thanks.
0
Comment
Question by:xfvgdrthbdtyvhgscv
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
aelatik earned 500 total points
ID: 10851231
I think you need to loop through all open IE sessions to get your textbox value. This code loops through all open IE session and checks if the site is the site you wish to fetch your value from.
After that it returns the value of a textbox. There is also a "parent" method but i could't test that one. You could try it out. It could work without looping trhough all IE sessions.
Code is made for google, you need to adapt the field and sitenames to meet your requirements.

    Dim X, IE
    Set X = CreateObject("shell.application")
    Set IE = CreateObject("internetexplorer.application")
    For Each IE In X.windows
        If InStr(1, IE.Document.Title, "google", vbTextCompare) Then ' check if the title of the site contains the text you need, for example 'Google' to make sure its google
            MsgBox IE.Document.gs.q.Value ' Object.Document.Formname.Fieldname.Value
            'There is alo a possibility to use, IE.parent.document.gs.q.value
            ' But i couldn't test that one, you can test it in your powerpoint file
        End If
    Next
    Set IE = Nothing
    Set X = Nothing

Good luck,
Ayhan Elatik
0
 
LVL 1

Author Comment

by:xfvgdrthbdtyvhgscv
ID: 10851280
Ayhan,

Genius.  That works perfectly.  The points are yours hands down.

Thanks a million (or 500 at least, the most the system will let me award)

0
 
LVL 14

Expert Comment

by:aelatik
ID: 10851284
Glad it worked for you...:-)
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This very simple solution applies to a narrow cross-section of the "needs to close" variety. In this case, the full message in Event Viewer was in applog, Event ID 1000: Faulting application iexplore.exe, version 8.0.6001.18702, faulting module …
User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now