Thread: dll reference
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rob Bovey Rob Bovey is offline
external usenet poster
 
Posts: 811
Default dll reference

Hi Dwight,

If I update a dll, does one have to relink the macro to dll?


If you change anything that affects the public interface of the DLL then
you'll have to re-establish all of the references to it.

I have 4 dlls that are used within 100 macros. When changes are made to
the dlls, versioning isn't changed, or at least I don't think it is.


That depends on your project property settings. In VB6 under the
Project/<DLL name Properties menu look at the Component tab and see what
you have selected under Version Compatibility.

If it's No Compatibility then you will create MISSING references every
time you recompile. If it's Project Compatibility, VB will try to make the
new version compatible with the old version, but if the code modifications
you've made change the public interface then it won't work and you'll get
MISSING references.

Once you've deployed your DLL you should always develop using the Binary
Compatibility setting. Store a copy of the deployed DLL version in a
separate folder and point the file name box at that copy. If you then change
the DLL in such a way that it breaks the public interface, VB will warn you
and not allow you to compile the project. You can then decide whether it's
worth resetting all your references.

If so, unregister and delete any previous versions of your DLL, change
the compatibility setting to No Compatibility, compile a new version of your
DLL, copy that new version to the storage directory, change the
compatibility setting back to binary and make sure the file name box on the
Component tab is pointing at the new version of the DLL, then reset all your
MISSING references. This is one of the true joys of COM programming. :-)

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm

"Dwight" wrote in message
oups.com...
Thanks for the quick response Rob. So it sounds like it could be more
of a versioning problem.

If I update a dll, does one have to relink the macro to dll?


I have 4 dlls that are used within 100 macros. When changes are made to
the dlls, versioning isn't changed, or at least I don't think it is.

Thanks
Dwight


Rob Bovey wrote:
Hi Dwight,

MISSING references are usually caused by versioning problems (the
version of the DLL on the machine is not the same as the version of the
DLL
referenced by Excel) or incorrect registration of the DLL on the machine.

First try closing excel and re-registering the DLL by opening a
command
window and running:

C:regsvr32 "C:\<your path\<your dll name.dll"

where "C:\<your path\<your dll name.dll" is the exact path and filename
of
the dll on that computer. If that doesn't solve the problem you have a
versioning issue.

The only way to solve this is to open the affected workbook, choose
Tools/References from the VBE menu, uncheck the MISSING reference and
click
OK, choose Tools/References again and reselect the reference.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm

"Dwight" wrote in message
oups.com...
I reference dlls for excel macros and occasionally, I get a MISSING
error. It usually happens when the dll is in a different path than
originally programmed. For example: c:\windows\system and
c:\winnt\system.

Does excel store the original path? I assume it should be getting it
from the registry.

Thanks
Dwight