That kind of DLLs needs to be in your search path. They are normally located into System or System32 folder.
>Very true, but (sadly) it is not a COM DLL, just an ordinary DLL such as those that contain the Windows API routines.
>
>So the question stands: how does one declare DLL routines in a DLL whose location is not known until runtime?
>
>>If it is a COM DLL (one that has registry entries), you don't need to care about the path. You simply register it. To use it, you can't DECLARE it, you need to set a reference (from the VB menu, Project->References). If you enter VBA, you will find Refences in one of the menu too.
>>
>>
>>>I have an application folder which contains a DLL. I also have a Office Template with a macro that needs to access the DLL. I know at runtime (via a Registry entry) what folder the DLL is in, but not at Design Time. Declaring the functions in the DLL via the "Declare Sub
Lib "
>>>is a Declaration which presumably(?) must be resolvable at Compile-Time.
>>>
>>>If I put the DLL in the System32 directory, VBA will find it. I would prefer not to (who wouldn't?). Is this just a limitation of VBA, or is there a technique I'm not aware of that will allow me to declare the actual location of the DLL at runtime?
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com