Solved

VBA accessing Internet Explorer window properties

Posted on 2004-04-17
3
1,554 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

MS Access 2003 or later To MySQL Migration Project Hello All, this is my second article in the category of MS-OFFICE Automation. In internet I am not able to find any comprehensive resource on the Migration of MS Access back-end to MySQL so I fin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

821 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