Identify Browser Version using Excel VBA:-
Sub CheckWebOptions()
Dim wkbOne As Workbook
Set wkbOne = Application.Workbooks(1)
‘ Determine if IE8 is the target browser.
If wkbOne.WebOptions.TargetBrowser = msoTargetBrowserIE6 Then
MsgBox "The target browser is IE6 or later."
ElseIf wkbOne.WebOptions.TargetBrowser = msoTargetBrowserIE5 Then
MsgBox "The target browser is IE5 or later."
ElseIf wkbOne.WebOptions.TargetBrowser = msoTargetBrowserIE4 Then
MsgBox "The target browser is IE4 or later."
ElseIf wkbOne.WebOptions.TargetBrowser = msoTargetBrowserV4 Then
MsgBox "Microsoft Internet Explorer 4.0, Netscape Navigator 4.0, or later."
ElseIf wkbOne.WebOptions.TargetBrowser = msoTargetBrowserV3 Then
MsgBox "Microsoft Internet Explorer 3.0, Netscape Navigator 3.0, or later."
Else
MsgBox "The target browser is not in the given list"
End If
End Sub
Sub CheckWebOptions()
Dim wkbOne As Workbook
Set wkbOne = Application.Workbooks(1)
‘ Determine if IE8 is the target browser.
If wkbOne.WebOptions.TargetBrowser = msoTargetBrowserIE6 Then
MsgBox "The target browser is IE6 or later."
ElseIf wkbOne.WebOptions.TargetBrowser = msoTargetBrowserIE5 Then
MsgBox "The target browser is IE5 or later."
ElseIf wkbOne.WebOptions.TargetBrowser = msoTargetBrowserIE4 Then
MsgBox "The target browser is IE4 or later."
ElseIf wkbOne.WebOptions.TargetBrowser = msoTargetBrowserV4 Then
MsgBox "Microsoft Internet Explorer 4.0, Netscape Navigator 4.0, or later."
ElseIf wkbOne.WebOptions.TargetBrowser = msoTargetBrowserV3 Then
MsgBox "Microsoft Internet Explorer 3.0, Netscape Navigator 3.0, or later."
Else
MsgBox "The target browser is not in the given list"
End If
End Sub
No comments:
Post a Comment