-4

Is their a way to check an application exists before I write in the code to create the object

I know this is install and I can use it but what if I want the program to check first ?

Set objOutlook = GetObject("Outlook.Application")
Pavle Stojanovic
  • 525
  • 2
  • 8
  • 30

1 Answers1

0

In fact, you should verify if there is entry in Registry. You can proceed as follows;

 Dim regKey As RegistryKey  

 regKey = My.Computer.Registry.ClassesRoot.OpenSubKey("Outlook.Application", False).OpenSubKey("CurVer", False)  

 If not string.IsNullOrEmpty(regKey.GetValue("")) then

// Your code

 End if
Nadeem_MK
  • 7,533
  • 7
  • 50
  • 61