[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2942
  • Last Modified:

Get Internet Explorer version from VBA

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
Sandstedt
Asked:
Sandstedt
1 Solution
 
SandstedtAuthor Commented:
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now