I have created activex dll using vb6. I have registered it using
regsvr32 on my clients pc. I call the dll functions from both VB exe file
and Excel VBA. All works fine so far. When I Remake my DLL file with
VB6 both the VB exe and the Excel VBA can no longer reference my DLL.
The version of my DLL is the same. For it to work I need to delete the
reference in Excell VBA and then Browse for the same DLL in the same
place and it works ok after that. For the VB exe file I need to do the same
and recompile the exe. How can I have the reference remain in place while
the dll file is the same? I want to be able to change my business logic in
the dll without having to reinstall all my software on my clients pc.

Hi,

Use Late Binding of the .dll, like Create object.
Dont directly add the reference in VB6 (Calling project).

Dim MyObj As Object
Set MyObj = CreateObject("MyProj.MyDll")
This code creates an instance of the MyDll class that is defined by the DLL project named MyProj. After Creating the Class Object, U can use the Public properties and methods of the MyObj object just as if it had declared it using early binding. Now if you change the DLL's public methods, the compiled executable will still work (if you removed the methods the program uses). The problem with late binding is you don't get intellisense and calling the DLL's methods may take a bit longer time than it does with early binding.
And In Your Calling / Main Project, Just by Replacing the .dll, ur exe will work.


Regards
Veena

commented: Good one - ~s.o.s~ +11

That fixed it. Thanks very much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.