Accessing DLLs through VBA

大城市里の小女人 提交于 2020-01-25 07:22:07

问题


How can I access the functions inside a third-party DLL from VBA (Excel)? Also, is there a way to see what all functions are available inside a DLL?


回答1:


To call a function in a third-party DLL, you need to use the Declare statement. For example:

Private Declare Function GetTempPath Lib "kernel32" _
     Alias "GetTempPathA" (ByVal nBufferLength As Long, _
     ByVal lpBuffer As String) As Long

See How to: Access DLLs in Excel on MSDN for more information.


To list the functions that are available, take a look at the Dependency Walker tool, which will list the exported functions from DLLs (and lots of other information).



来源:https://stackoverflow.com/questions/59190015/how-to-add-a-dll-to-ms-access-vba

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!