Windows will search for a dll in a number of places. IIRC:
- the %System% dir
- in the folders listed by the PATH enviroment > Debug.Print Environ("PATH")
- in the folder containing the calling component
So put your dll in one of the above location for windows to be able to
locate it.
You can also fully qualify the path the dll if you know/control where it is
installed:
Declare Function currentMilli Lib "C:\exceltest.dll" () As Long
As a side note, if you will be passing string to/from the dll, you should be
aware of the way that Excel/VBA differ in how strings are handled.
If called from the worksheet, you should use a W (Wide) version of the
function call as Excel uses Unicode.
Called from VBA, you can use an A (ANSI) version and let VBA handle string
conversion, which may not advisable as you seem to be from Korea and may not
be using only Ansi text and/or single byte char sets.
Alternative, look into the use of a W version and handling the strings
yourself with Byte arrays/StrConv.
This may help, in the section "ANSI vs. Unicode and the Alias Clause"
http://www.awprofessional.com/articl...&seqNum=3&rl=1
NickHK
"sunny" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I made a dll and I used it in VBA
> Like this:
> Declare Function currentMilli Lib "exceltest.dll" () As Long
>
> It's working on my computer in any folders.
> But when I tried it on other's computer it worked only in the "My
> documents" folder.
> I expected that it would work if the dll file and the excel file are
> in the same folder.
> What on earth is going on? How can I make it available on other's
> computer in any folders?
> Thanks in advance.
>