Change references if missing
Hi,
I have an Excel VBA file that uses the Microsoft Outlook 10.0 Object Library. The problem I am having is this..... When someone opens the file with a newer version (11.0) of the object library then saves it, then a person with the older version (10.0) opens the file and tries to run the macro it gives them an error because it shows in the references that the 11.0 library is missing. So, you have to go in and uncheck the missing 11.0 library and check the 10.0 library.
Is there a way to check for missing references in the workbook.open() event and switch the references to the appropriate library through code?
Any help would be appreciated. Thank you!
Re: Change references if missing
This is a known problem. So instead of using Early Binding, use Late Binding and don't set any references. This way the program will still work with both the versions 10 & 11 :)
Re: Change references if missing
Late binding example
instead of:
Dim xls as Excel.Application
Dim xls as Object
set xls = CreateObject("Excel.Application")
but my guess is this is all in excel right?
so u are not binding at all...
well, there was a way to do this , but excel keeps complaining and it wont work...
anyway...
put something in the before save event.. to tell users to save as excel 10?
VB Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
End Sub
Re: Change references if missing
Quote:
but my guess is this is all in excel right?
so u are not binding at all...
he is referencing outlook
can you late bind like this for ADO too? if so do you need to know which version is installed?
pete
Re: Change references if missing
Thank you so much! I used the late binding for the outlook reference. I am assuming you could do this for any reference?
Re: Change references if missing
yes
Set objName = CreateObject("Word.Application")
Set objName = CreateObject("InternetExplorer.Application")
Set objName = CreateObject("Excel.Application")
etc...