Solved

VBA accessing Internet Explorer window properties

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Microsoft Access 2010 Question 2 63
VB6 - Convert HH:MM into Decimal 8 53
How to make an ADE file by code? 11 80
Complete list of Microsoft tech support phone numbers 5 81
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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.
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…
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…

867 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

19 Experts available now in Live!

Get 1:1 Help Now