Friday, June 4, 2010

IE-DOM -GetVersion

'Get the version of IE currently installed on your local machine.
'Source MSDN
' 04/06/2010

**********************************************************************
strVersion = BrowserVersion

MsgBox strVersion

Function BrowserVersion

'String variable to hold the computer name
Dim strComputer
'String variable to hold the Registry key reference
Dim HKEY_LOCAL_MACHINE
'Registry object
Dim oReg
'String variable to hold the registry key path
Dim strKeyPath
'String variable to hold the registry key path
Dim strValueName
'String variable to hold the registry key value
Dim strValue
'Place Holder
Dim arrTmp

HKEY_LOCAL_MACHINE = 2147483650
strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\Internet Explorer"
strValueName = "Version"

oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

If Instr(strValue," ") Then
arrTmp = split(strValue, " ")
BrowserVersion= arrTmp(0)
Else
BrowserVersion=strValue
End If

End Function

**********************************************************************

No comments: