VBA codes to determine program installed on PC.

F

Francis Ang

How do I write the VBA code to determine whether Microsoft Outlook or Outlook Express has been installed on a PC? Would appreciate any help.
 
M

Michel Pierron

Hi Francis,
here a way of doing that:

Sub OL_Test()
Const Pth As String = "HKLM\Software\Clients\Mail\"
Const Msg As String = "installed on this computer !"
Dim OL(1, 1) As String
OL(0, 0) = "Microsoft Outlook": OL(1, 0) = "Outlook Express"
OL(0, 1) = " is not ": OL(1, 1) = " is not "
If sKey(Pth & OL(0, 0) & "\") Then OL(0, 1) = " is "
If sKey(Pth & OL(1, 0) & "\") Then OL(1, 1) = " is "
MsgBox OL(0, 0) & OL(0, 1) & Msg & vbLf & OL(1, 0) & OL(1, 1) & Msg, 64
End Sub

Function sKey(K) As Boolean
Dim R
On Error Resume Next
R = CreateObject("WScript.Shell").RegRead(K)
sKey = (Err = 0)
End Function

Regards,
MP

Francis Ang said:
How do I write the VBA code to determine whether Microsoft Outlook or Outlook
Express has been installed on a PC? Would appreciate any help.
 
Top