Solved

Get Internet Explorer version from VBA

Posted on 2013-01-10
2
2,661 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
2 Comments
 
LVL 27

Accepted Solution

by:
MacroShadow earned 500 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
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…

777 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