VBA script CreateObject not working in 2019 & office365 whereas working in 2021 version.

Anonymous
2024-03-12T10:40:36+00:00

Hi,

I have created a plugin/Addin for MS Excel and trying to call a function from VBA script. Getting the ActiveX component cannot be created. I have registered the plugin as well as referenced from the Tools > Reference > ThisAddIn.

The script is working fine in Excel 2021 version but getting the error in 2019 and office365 version. Any suggestion or solution?

namespace name = ThisAddin

class name = Main

ProgId = Main

function Execute

Approach 1:
Sub RefreshConnections()
Dim addInObj As Object
Set addInObj = CreateObject("Main")
addInObj.Execute '
End Sub

Approach 2:

Sub RefreshConnections()
Dim addInObj As Object
Set addInObj = CreateObject("ThisAddin.Main")
addInObj.Execute '
End Sub

Tried above approaches but not working...

Thanks,
Tanmay

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rory Archibald 18,875 Reputation points Volunteer Moderator
    2024-03-12T11:49:35+00:00

    Are the versions all the same bitness? Perhaps the two that don't work are 64bit applications and the other is 32 bit (or vice versa) and your add-in is not compiled for one.

    0 comments No comments