Access DLL through VBA

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

+5
source share
1 answer

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

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

See How to access a DLL in Excel on MSDN for more information.


To list the available functions, check out the Dependency Walker tool , which will list the exported functions from the DLL (and lots of other information).

+7
source

All Articles