With this code i send a email with outlook.
it works great , but when there is no outlook on the pc installed the programma crash.
Try and catch is not working ?
The error is
Who can help me ?
Code:
Dim application = New Microsoft.Office.Interop.Outlook.Application
Dim outlookEmail = CType(application.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem), MailItem)
outlookEmail.To = "*********@gmail.com"
outlookEmail.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatPlain
outlookEmail.Importance = Microsoft.Office.Interop.Outlook.OlImportance.olImportanceNormal
outlookEmail.Body = ("Test")
outlookEmail.Subject = ("Ok")
outlookEmail.Display(False)
outlookEmail.Send()Try and catch is not working ?
The error is
Code:
'Catch' cannot catch type 'Microsoft.Office.Interop.Outlook.Exception' because it is not 'System.Exception' or a class that inherits from 'System.Exception'.