excel - Cannot add DLL reference with AddFromFile -


i trying use com visible .net dll excel vba. have been successful when registering dll using regasm , manually adding reference via tools -> references menu item in vba developer window.

however, trying register dll without using regasm command excel file can used on computer without registering dll. far i've tried:

dim jart_instance object  sub initialize()     dim refpath string, x byte     const refname = "jart xxx"     refpath = application.activeworkbook.path & "\jart\jart.dll"      activeworkbook.vbproject.references         x = 1 .count             if .item(x).description refname                 .remove .item(x)             end if         next        .addfromfile (refpath)     end end sub  sub postinitialize()     set jart_instance = new jart.mainjobcontrol end sub 

i have added reference "microsoft visual basic applications extensibility 5.3". when run above code "run-time error '48': error in loading dll". have loaded dll couple times using regasm. need change guid's used in project , retry. i've seen code examples supposed work.

if reference tlb file instead of .dll not dll loading error. instead error whenever try use jart_instance variable saying reference has not been set. though postinitialize gets called directly after initialize , there no evidence of code threw error or failed run. if try put "stop" command in postinitialize function tells me "cannot enter break-mode @ time".

any ideas, thanks.

excel-dna has helper function com addins written on platform.

it appears to:

  1. load addin
  2. register coregisterclassobject
  3. add it's progid registry
  4. add registry key hkcu\software\microsoft\office\excel\addins
  5. call application.comaddins.update in excel
  6. remove previous registry entries
  7. unregister object corevokeclassobject

it appear once excel has loaded addon, doesn't unload when registry entries removed , corevokeclassobject called. stays loaded until excel closes , releases it.

so, it's doable not easy.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -