从Excel VBA调用非注册的.NET DLL [英] Call non-registered .NET dll from Excel VBA

查看:540
本文介绍了从Excel VBA调用非注册的.NET DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编写一个可以直接从Excel的VBA模块调用的.NET DLL,以便将dll和.xls简单地部署在同一个目录中,无需任何COM注册。

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 registration.

dll的目的是运行在C中实现的算法。

Purpose of dll is to run algorithms implemented in C.

我应该如何处理?这是可能的吗?

How should I proceed? Is this possible at all?

推荐答案

您不会解释.NET在您的方案中的作用。你可以使用'Declare Function'直接从VBA调用很多C库。

You don't explain what the role of .NET would be in your scenario. You can indeed call many C libraries directly from VBA using 'Declare Function'.

如果你发现.NET很有用,并且想要调用.NET库函数,从Excel定义的函数(UDF),您可以使用 Excel-DNA 。它为您提供一个.xll加载项库,将您的.NET库集成到Excel中。您仍然必须通过文件 - >打开将文件添加为Excel加载项,或者从工作簿中的某些VBA自动打开.xll加载项。但是它不需要其他注册。

If you find .NET useful, and want to call your .NET library functions as user-defined functions (UDFs) from Excel, you can use Excel-DNA. It gives you an .xll add-in library that integrates your .NET library into Excel. You'd still have to open the .xll add-in somehow - either by File -> Open, by adding it as an Excel add-in, or automatically from some VBA in your workbook. But it needs no other registration.

从.NET库中,您可以使用P / Invoke调用C .dll函数,添加类别,函数和参数说明来集成功能向导等。

From the .NET library you can call the C .dll functions using P/Invoke, add categories, function and argument descriptions to integrate into the function wizard etc.

(免责声明:我是Excel-DNA的开发人员。)

(Disclaimer: I'm the developer of Excel-DNA.)

这篇关于从Excel VBA调用非注册的.NET DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆