?
Solved

Get Internet Explorer version from VBA

Posted on 2013-01-10
2
Medium Priority
?
2,842 Views
Last Modified: 2013-01-10
Hi,

I am looking for some VBA code that tells me what IE version is installed. In IE8, I could do like this:

Set InternetExplorer = CreateObject("InternetExplorer.Application")
InternetExplorer.Visible = True
InternetExplorer.Navigate "https://www.google.se/"

InternetExplorer.Document.parentWindow.execScript "document.clear(); document.write(navigator.appVersion);"
str_IEVersion = Trim(Split(InternetExplorer.Document.DocumentElement.outerText, ";")(1))

Open in new window


And the result would be "MSIE 8.0". In IE9 however, this code results in this error message: "Run-time error -2147352319 (80020101)". Anyone?
0
Comment
Question by:Sandstedt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 27

Accepted Solution

by:
MacroShadow earned 2000 total points
ID: 38764894
0
 

Author Comment

by:Sandstedt
ID: 38764945
Thank you! Solution:

Dim obj_FSO As Object
Dim obj_Shell As Object
Dim str_IEVersion As String

Set obj_FSO = CreateObject("scripting.filesystemobject")
Set obj_Shell = CreateObject("wscript.shell")

str_IEVersion = obj_FSO.getfileversion(obj_Shell.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\" & "App Paths\IEXPLORE.EXE\"))

Open in new window


Result: "9.0.8112.16457"
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

771 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