'ActiveX cannot create object on Set outA = CreateObject("Outlook.Application")

I have a legacy VB6 application to allow a user to send an email from the application itself.

Dim outA As Outlook.Application

Set outA = New Outlook.Application

If outA Is Nothing = True Then
    'Outlook is not open... so need to create a new outlook
    Set outA = CreateObject("Outlook.Application")
End If

In Windows 7 Office 2007 it works. User can have Outlook open and it works with no issues.

In Windows 10 Office 2016 this code does not work. It gives me an error on

Set outA = New Outlook.Application. 

If Outlook is not open, the code works. I'm only getting this error if Outlook is open.

The error is...

ActiveX cannot create object error 429.

I have local privelages on my computer.
If I open my VB6 .exe explicitly as ADMIN and Outlook as ADMIN as well - the code gives me no issues.
I have UAC prompt disabled.
I cannot give ADMIN rights to user.

Am I missing a dll or something? I have a few more applications that have been used in Windows 7 and I have not had this issue.



Solution 1:[1]

Keep the early binding for development and once complete, scrap it for the late bind. Don't forget to remove the reference to Microsoft Outlook xx Object Library in VBE.

Early binding:

Dim outA As Outlook.Application
Set outA = New Outlook.Application

Late Binding:

Dim outA As Object
Set outA = CreateObject("Outlook.Application")

The reason is that early binding references a specific version of Outlook e.g. Microsoft Outlook 14.0 Object Library which is specific for Office 2010, so if it's not available it throws an error. The reference itself is marked with a "missing".

The late binding's CreateObject("Outlook.Application") takes care of that.

Solution 2:[2]

Repare office and ok (for me that was the solution)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kostas K.
Solution 2 Eric Aya