Excel-DNA in VBA code - ActiveX Component cant create object - Runtime Error '429'

446 views
Skip to first unread message

hurshb

unread,
Feb 3, 2018, 7:56:48 PM2/3/18
to Excel-DNA
Hi,

I have been trying to use my c# code in vba. 

I followed the instructions as posted on this link by Michael Katajamaki  - http://mikejuniperhill.blogspot.co.uk/2014/03/interfacing-c-and-vba-with-exceldna_16.html

my code, when run in vba, is giving error - Runtime Error '429' - ActiveX component cant create object.

To test I wasn't doing anything wrong, I replicated everything Mikael posted to see if his code worked. the only changes I did was, as excel-dna creates -addin.xll files, I copied XLserver-addin.xll to XLserver.xll before creating tlb export.

For me, even the code, copy pasted from Mikael's blog is leading to Error 429.

Please can someone advise what I could be doing wrong?

Thanks
Hursh


Govert van Drimmelen

unread,
Feb 4, 2018, 8:27:09 AM2/4/18
to exce...@googlegroups.com
Hi Hursh,

I've had a quick run through the whole process of making the Excel-DNA COM server add-in, and it seems to work OK.

I used the NuGet package, so didn't follow the steps in that blog post exactly, though I can't see anything obvious that's wrong there.

The step-by-step instructions for what I did and the resulting project is here: https://github.com/Excel-DNA/Samples/tree/master/DnaComServer

Maybe you can give that a try to see if it works if you follow along.
If not, let me know where you get stuck.

Regards,
Govert



From: exce...@googlegroups.com [exce...@googlegroups.com] on behalf of hurshb [hursh....@gmail.com]
Sent: 04 February 2018 02:56 AM
To: Excel-DNA
Subject: [ExcelDna] Excel-DNA in VBA code - ActiveX Component cant create object - Runtime Error '429'

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at https://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.

hurshb

unread,
Feb 7, 2018, 4:26:21 PM2/7/18
to Excel-DNA
Hi Govert,

Thanks for your quick reply and apologies for getting back late to you.

All works as per instructions. In fact I can also add another library (NLog.dll) as a packed library, which is what I was trying to do. I am not sure what was different in your instructions, but hey this works.

There were issues in post build instructions though. I use VS2017 community edition
1. $(ProjectDir)\ does need the \, so removed them.
2. $(ProjectDir)packages is actually $(ProjectDir)..\packages
3. I didnt test regsv32 as I intend to share my code, so I wish to have same user experience, viz running my xll/tlb with no regsv32 registrations (lack of admin rights)

I have pasted the amended post-build I had to use

REM Setting up environment vairables
REM this is the location of dev cmd line, which is also available as dev prompt on start menu
call "$(DevEnvDir)..\Tools\VsDevCmd.bat"


REM Temporarily copy ExcelDna.Integration.dll into output
REM Note: Might need to change depending on where packages directory is
copy "$(ProjectDir)\packages\ExcelDna.Integration.0.34.6\lib\ExcelDna.Integration.dll" "$(TargetDir)"

REM Create .tlb file
tlbexp.exe "$(ProjectDir)$(OutDir)$(TargetName)$(TargetExt)" /out:"$(ProjectDir)$(OutDir)$(TargetName).tlb"

REM Delete extra copy of ExcelDna.Integration.dll from output
del "$(TargetDir)ExcelDna.Integration.dll"

REM Re-run the packing to include the .tlb inside the packed files for distribution
REM Note: Might need to change depending on where packages directory is
"$(ProjectDir)..\packages\ExcelDna.AddIn.0.34.6\tools\ExcelDnaPack.exe" "$(ProjectDir)$(OutDir)$(TargetName)-AddIn.dna" /Y  /O "$(ProjectDir)$(OutDir)$(TargetName)-AddIn-packed.xll"
"$(ProjectDir)..\packages\ExcelDna.AddIn.0.34.6\tools\ExcelDnaPack.exe" "$(ProjectDir)$(OutDir)$(TargetName)-AddIn64.dna" /Y  /O "$(ProjectDir)$(OutDir)$(TargetName)-AddIn64-packed.xll"
To post to this group, send email to exc...@googlegroups.com.

Govert van Drimmelen

unread,
Feb 8, 2018, 2:59:01 AM2/8/18
to exce...@googlegroups.com
I'm glad you got it working.

To be clear - running regsvr32 to pre-register the COM aspects can be done on the client and does not require admin rights.

-Govert
To post to this group, send email to exce...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages