Excel Error: ‘ActiveX component can’t create object’ after KiteNet/Upstoxnet DLL update

Developers,

You may receive one or all of the below mentioned errors in Excel/VBA after updating KiteNet/UpstoxNet.dll

‘ActiveX component can’t create object’
‘Automation Server Can’t Create Object’
‘Can’t find project or library’

Note: The below solution is applicable only if you get the above errors after updating KiteNet/UpstoxNet.dll

Background:

When we update a new version of .Net COM DLL (like KiteNet/UpstoxNet) in the system, the Excel/VBA will still look for the older version of the DLL with which the VBA Project is created initially. Since the old DLL is replaced with the new DLL, Excel/VBA will throw the above errors as it is unable to find the old DLL.

Solution:

1. Go to Visual Basic editor : Menu –> Developer Tab –> Select ‘Visual Basic’ or simply Press Alt + F11

2. Once the Visual Basic editor is opened, select the ‘KiteXL/UpstoxXL’ module or the module where you initialized ‘Kite/Upstox’ class from the project explorer. (If project explorer is not visible then : Menu –> View –> Select ‘Project Explorer’ or simply press Ctrl + R)

3. Just select all the code in the right side by pressing Ctrl + A and cut all the code by pressing Ctrl + X and again paste all the code by pressing Ctrl + V .

4. Now compile VBA Project by Menu –> Debug –> Select ‘Compile VBA Project’

5. Save VBA Project and Excel.

6. That’s it, now you can use KiteXL/UpstoxXL.

Here is how it worked, when we cut and paste the code in VBA, we (re)created the VBA Project which uses the new version of the .Net COM DLL.

KiteNet:

UpstoxNet:

ChokS

ChokS

.Net Programmer. AFL Coder. Author of KiteDotNet & KiteXL.

Leave a Reply

Your email address will not be published.