Solved

VBA accessing Internet Explorer window properties

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
This collection of functions covers all the normal rounding methods of just about any numeric value.
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 …
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…

803 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