Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Vj Vj is offline
external usenet poster
 
Posts: 54
Default Find internet explorer is installed using vba excel

Hi,

Is there any way I can find out whether Internet Explorer is installed in
machine using VBA?

I already have a code in which I can open hyperlink using VBA but one of my
test machine has mac which doesnot have IE.

I need to add the error handling that If IE is not installed then Use the
Safari instead of IE.

Help would be appreciated.

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Find internet explorer is installed using vba excel

Insert a new module and paste the below code.

Sub Macro()
If IsIEAvailable Then
'Use IE
Else
'Use Safari
End If
End Sub



Option Explicit

Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias _
"RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, _
ByVal ulOptions As Long, ByVal samDesired As Long, _
phkResult As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" _
(ByVal hKey As Long) As Long
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias _
"RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName _
As String, ByVal lpReserved As Long, lpType As Long, _
lpData As Any, lpcbData As Long) As Long

Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const ERROR_SUCCESS = 0&
Private Const STANDARD_RIGHTS_ALL = &H1F0000
Private Const KEY_QUERY_VALUE = &H1
Private Const KEY_SET_VALUE = &H2
Private Const KEY_CREATE_SUB_KEY = &H4
Private Const KEY_ENUMERATE_SUB_KEYS = &H8
Private Const KEY_NOTIFY = &H10
Private Const KEY_CREATE_LINK = &H20
Private Const SYNCHRONIZE = &H100000
Private Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE _
Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY Or _
KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Or KEY_CREATE_LINK) _
And (Not SYNCHRONIZE))
Public Function IsIEAvailable() As Boolean

Dim hKeyOpen As Long
Dim lKeyResult As Long
Dim lKeyQueryLen As Long

lKeyResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _
"Software\\Microsoft\\Windows\\CurrentVersion\ \App Paths" _
& "\\IEXPLORE.EXE" & Chr$(0), &H0, KEY_ALL_ACCESS, hKeyOpen)
lKeyResult = RegQueryValueEx(hKeyOpen, "Path", 0&, 0&, 0&, _
lKeyQueryLen)
If lKeyQueryLen 0 Then
IsIEAvailable = True
Else
IsIEAvailable = False
End If
RegCloseKey hKeyOpen

End Function
--
If this post helps click Yes
---------------
Jacob Skaria


"VJ" wrote:

Hi,

Is there any way I can find out whether Internet Explorer is installed in
machine using VBA?

I already have a code in which I can open hyperlink using VBA but one of my
test machine has mac which doesnot have IE.

I need to add the error handling that If IE is not installed then Use the
Safari instead of IE.

Help would be appreciated.

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Find internet explorer is installed using vba excel

You could try:

Dim ie As Object
On Error Goto NoIE
Set ie = CreateObject("InternetExplorer.Application")
On Error Goto 0
Goto BrowserOK
NoIE:
On Error Goto NoSafari
Set ie = CreateObject("Safari.Application")
Goto BrowserOK
NoSafari:
Msgbox "No Browser"
Exit Sub
BrowserOK:
--
HTH,
Bernie
MS Excel MVP


"VJ" wrote in message
...
Hi,

Is there any way I can find out whether Internet Explorer is installed in
machine using VBA?

I already have a code in which I can open hyperlink using VBA but one of my
test machine has mac which doesnot have IE.

I need to add the error handling that If IE is not installed then Use the
Safari instead of IE.

Help would be appreciated.

Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
Vj Vj is offline
external usenet poster
 
Posts: 54
Default Find internet explorer is installed using vba excel

Thanks guys for your help.

Appreciate your efforts.

"Bernie Deitrick" wrote:

You could try:

Dim ie As Object
On Error Goto NoIE
Set ie = CreateObject("InternetExplorer.Application")
On Error Goto 0
Goto BrowserOK
NoIE:
On Error Goto NoSafari
Set ie = CreateObject("Safari.Application")
Goto BrowserOK
NoSafari:
Msgbox "No Browser"
Exit Sub
BrowserOK:
--
HTH,
Bernie
MS Excel MVP


"VJ" wrote in message
...
Hi,

Is there any way I can find out whether Internet Explorer is installed in
machine using VBA?

I already have a code in which I can open hyperlink using VBA but one of my
test machine has mac which doesnot have IE.

I need to add the error handling that If IE is not installed then Use the
Safari instead of IE.

Help would be appreciated.

Thanks




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel/VBA/Internet Explorer Alex[_30_] Excel Programming 1 November 22nd 05 05:09 PM
Excel Macro cannot Run at Internet Explorer 6 WCNW Excel Programming 1 August 17th 05 03:51 AM
Internet Explorer & Excel David Excel Programming 0 February 4th 05 08:51 PM
Internet Explorer Automation with Excel VBA Joćo Rodrigues Excel Programming 0 July 22nd 04 06:55 PM
Calling an Excel Doc from Internet Explorer Sven Schulze Excel Programming 0 February 25th 04 10:10 AM


All times are GMT +1. The time now is 09:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"