Call non-registered .NET dll from Excel VBA

前端 未结 3 1309
北海茫月
北海茫月 2020-12-19 07:58

I need to write a .NET dll that can be called directly from an Excel\'s VBA Module such that the dll and .xls are simply deployed in the same directory without any COM regis

3条回答
  •  时光说笑
    2020-12-19 08:39

    Have you seen this MSDN article? Basically you register functions from a DLL, not a DLL itself. I don't know if it is put very clear in the article, but the syntax is:

    [Public | Private] Declare Function name Lib "libname" [Alias "aliasname"] [([arglist])] [As type]
    

    where "libname" can contain full path e.g. "C:\tmp\algo.dll" or only a name e.g. "algo.dll". In the second case the local path will be searched for a matching binary.

提交回复
热议问题