new outlook.application not working if outllok is opened

  • Thread starter Thread starter Leon P
  • Start date Start date
L

Leon P

Guest
Hi

I'm trying to access open outlook instance from vb.net project.
On Error Resume Next
OutlookApp = GetObject(, "Outlook.Application")
If OutlookApp Is Nothing Then
OutlookApp = New Outlook.Application
End If

On the line "OutlookApp = GetObject(, "Outlook.Application")" I'm getting

Exception thrown: 'System.Exception' in Microsoft.VisualBasic.dll Cannot create ActiveX component

If I'm trying to use "OutlookApp = New Outlook.Application" when the outlook is open I'm getting the same error, but if the outlook is closed it working fine.

Is there another way to check if the outlook is open and get an instance to its object?

My environment:
win 10 64 bit
office 365 64 bit
Visual Studio Community 2019 ver 4.8.03761


Leon

Continue reading...
 
Back
Top