See the Declare statement. E.g.,
Public Declare Function MyFunction Lib "FileName.dll" (Args As Whatever) As
Long
Sub AAA()
Dim Res As Long
Res = MyFunction(123,456)
End Sub
Note that (1) you cannot call functions in a DLL created in VB with this
syntax. VB can create only ActiveX DLLs that must be created as objects. (2)
the DLL function must have been compiled with the __stdcall directive, (3)
the function must have been included in the DEF file.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)
"XP" <(E-Mail Removed)> wrote in message
news:F8E656B8-E5AB-4028-ACC0-(E-Mail Removed)...
> Is there a way, using VBA to directly reference a DLL?
>
> Please note, I'm NOT looking for code that selects a reference in Tools
> then
> References, but instead allows a direct DLL call.
>
> If so, your example code would be appreciated.
>
> Thanks much.