【发布时间】:2011-08-14 21:54:02
【问题描述】:
如何从 VBA (Excel) 访问第三方 DLL 中的函数?另外,有没有办法查看 DLL 中所有可用的函数?
【问题讨论】:
如何从 VBA (Excel) 访问第三方 DLL 中的函数?另外,有没有办法查看 DLL 中所有可用的函数?
【问题讨论】:
要调用第三方 DLL 中的函数,需要使用 Declare 语句。例如:
Private Declare Function GetTempPath Lib "kernel32" _
Alias "GetTempPathA" (ByVal nBufferLength As Long, _
ByVal lpBuffer As String) As Long
有关详细信息,请参阅 MSDN 上的 How to: Access DLLs in Excel。
要列出可用的函数,请查看Dependency Walker 工具,该工具将列出从 DLL 导出的函数(以及许多其他信息)。
【讨论】: