ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB6 DLL addin trouble (https://www.excelbanter.com/excel-programming/319158-vb6-dll-addin-trouble.html)

R Avery

VB6 DLL addin trouble
 
I have several DLLs that i make in VB6, and whenever I update them by
adding new functions, all the references that my workbooks made to these
DLLs are now broken and i have to reset them. Why does this happen? Is
it because the workbooks are bound to the GUID of the DLL, which perhaps
changes on every compilation? If so, is there anyway in VB6 to compile
DLLs with the same GUID? Or is there any programmatic way to update the
references to my workbooks so that i won't have to keep resetting them
manually?

Robin Hammond[_2_]

VB6 DLL addin trouble
 
1. Under project properties in VB, set Binary Compatability on the Component
tab.
1b. This won't always work because you might change some things in the
project such that compatability cannot be maintained.
2. In VBA, create the reference to the dll dynamically rather than through
the references. This means that if the system ref to the dll changes, you
will still get the correct file rather than having to unload the reference,
then reload it on the new id.

e.g.
Public DB as Object

Sub CreateRef()
If DB Is Nothing Then Set DB = CreateObject("myDll.clsName")
Exit Sub

HTH,

Robin Hammond
www.enhanceddatasystems.com

"R Avery" wrote in message
...
I have several DLLs that i make in VB6, and whenever I update them by
adding new functions, all the references that my workbooks made to these
DLLs are now broken and i have to reset them. Why does this happen? Is it
because the workbooks are bound to the GUID of the DLL, which perhaps
changes on every compilation? If so, is there anyway in VB6 to compile
DLLs with the same GUID? Or is there any programmatic way to update the
references to my workbooks so that i won't have to keep resetting them
manually?




R Avery

VB6 DLL addin trouble
 
Thanks a lot! This has really helped. Most of the time, I am only
changing the code inside procedures, not anything that would break
interfaces. Now i don't have to waste time always reseting references.

Thanks Robin.


Robin Hammond wrote:
1. Under project properties in VB, set Binary Compatability on the Component
tab.
1b. This won't always work because you might change some things in the
project such that compatability cannot be maintained.
2. In VBA, create the reference to the dll dynamically rather than through
the references. This means that if the system ref to the dll changes, you
will still get the correct file rather than having to unload the reference,
then reload it on the new id.

e.g.
Public DB as Object

Sub CreateRef()
If DB Is Nothing Then Set DB = CreateObject("myDll.clsName")
Exit Sub

HTH,

Robin Hammond
www.enhanceddatasystems.com

"R Avery" wrote in message
...

I have several DLLs that i make in VB6, and whenever I update them by
adding new functions, all the references that my workbooks made to these
DLLs are now broken and i have to reset them. Why does this happen? Is it
because the workbooks are bound to the GUID of the DLL, which perhaps
changes on every compilation? If so, is there anyway in VB6 to compile
DLLs with the same GUID? Or is there any programmatic way to update the
references to my workbooks so that i won't have to keep resetting them
manually?






All times are GMT +1. The time now is 01:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com