Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VBA accessing Internet Explorer window properties

Posted on 2004-04-17
3
Medium Priority
?
1,577 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 2000 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Suggested Courses

773 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