Error 429 only if Outlook is already open when try to automate an email
Hugh Self Taught
81
Reputation points
Good day Gurus of .Net
Since I started trying to get my app to be option strict compliant, I've suddenly started getting error 429 Unable to create active x component BUT only when Outlook is already open. I have the following code to get an instance of Outlook. The line "oOutlook = Activator.CreateInstance(outlookType)" returns the following error. Any ideas on how I rectify this will be greatly appreciated
Dim procs() As Process = Process.GetProcessesByName("Outlook")
If procs.Count > 0 Then
Dim outlookType As Type = Type.GetTypeFromProgID("Outlook.Application")
oOutlook = Activator.CreateInstance(outlookType)
Else
'oOutlook = New Outlook.Application()
oOutlook = New Microsoft.Office.Interop.Outlook.Application()
End If
oNameSpace = oOutlook.Session
Dim oFolder As Outlook.MAPIFolder = oNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
Sign in to answer