Hi @Hugh Self Taught ,
Attempt early binding first with New Microsoft.Office.Interop.Outlook.Application().
If early binding fails, fall back to late binding using reflection.
Option Strict On
Public Class OutlookManager
Private outlookApp As Object
Public Sub New()
Try
' Attempt early binding
outlookApp = New Microsoft.Office.Interop.Outlook.Application()
Catch ex As Exception
' Early binding failed, fall back to late binding
Dim outlookType As Type = Type.GetTypeFromProgID("Outlook.Application")
outlookApp = Activator.CreateInstance(outlookType)
End Try
End Sub
' Other methods and properties for Outlook automation
End Class
Best Regards.
Jiachen Li
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.