declare function (API in VB)


Posted by Fona on May 23, 2000 7:36 AM

Dear sir
I use office 2000,
I would like to declare function (from API in VB).
Usually,I used

Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
Declare Function FindNextFile Lib "kernel32"

in VB6 ->No problem

In excel ,Show compile error:User defined type not defined?????????

How I can use this function in macro

Remark: I tried to find function which faster than "DIR" function....

Best Regards



Posted by Ivan Moala on May 23, 2000 4:34 PM

Hi Fona
To use this function you have to define the type variables that this function is expecting to use Each variable must have its own type declaration, or it defaults to Variant.

Your 2nd function has not done this.
I believe the function should be;

Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long


Ivan