Error 429 only if Outlook is already open when try to automate an email

Hugh Self Taught 81 Reputation points
2024-04-18T12:05:49.05+00:00

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

Outlook Error2024-04-18 14_01_38-

            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)
	
Outlook
Outlook
A family of Microsoft email and calendar products.
2,990 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,575 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,500 questions
{count} votes