Removing broken references

T

Thor

I have an application that adds a references to MS Outlook Object Library.
Depending on pc the file us used on I need references to different versions
of the reference. For instance 11.0 at work but 9.0 at home. I can not add
9.0 if there already exist a reference to 11.0, even if the reference to 11.0
is broken.

How can I write the code to remove a broken reference?

There is no problem adding a new reference if it not there to begin with.

Thanks in advance
 
P

Paul Overway

Save yourself the headache and remove the reference permanently. Use late
binding instead...see help for CreateObject/GetObject.
 
T

Thor

I solved the first problem but I didn't get late binding correct. Now the
process sending mail from Excel doesn't work. My first choice would be to be
able to remove broken references via VB.
 
D

Douglas J. Steele

Paul's right that late binding is the appropriate solution to your problem,
not adding and removing references.

What's the problem you're encountering with late binding? There are really
only four things you should have to do to get late binding to work:

1) Remove the references
2) Replace the declarations from something like Dim objOutlook As
Outlook.Application to Dim objOutlook As Object
3) Change the instantiations from something like Set objOutlook = New
Outlook.Application to Set objOutlook = CreateObject("Outlook.Application")
4) Replace all of the references to intrinsic constants to the value of the
constant (or else declare the constants yourself)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top