View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jul Jul is offline
external usenet poster
 
Posts: 7
Default Using dll with a dynamic link in VB

In fact, I don't want the user to have access to the VB code. Yet, I want to
him to be able to choose where he wants to paste the dll on his computer (I
mean C:\\, or F:\\, ...).
So I wonder how he can from the Excel spreadsheet specify the location of
the dll (C:\\My documents...) to the VB code so that it changes the
declaration in VB (Declare Function MyFunction Lib "New adress")

thanks

"AA2e72E" wrote:

What do you mean by 'address'? Do you mean location within the filing system?
If yes, the location is irrelevant. A DLL is registered before it can be
used: if it needs to be overwritten, it must be overwritten at the same
location.

If a user wants to work with another copy in another location, the DLL must
be unregistered and registered from the new location.

If you are using "Declare Function ...", your DLL is a WIN32 DLL. The other
kind is an ActiveX DLL. Both kinds require registration.

"jul" wrote:

I have a function in a dll (built in C) that is called through Excel VBA.

Currently I declare my function in VB as follows:
Declare Function MyFunction Lib "C:\MyDll.dll" (ByVal ...) as Integer

Yet, I would like the user to be able to specify the adress of the dll in
excel (via a message box or a cell).

How can I change the link "C:\MyDll.dll" in a dynamic way in VBA.

Many thanks in advance

Julien