Breaking a Reference Error

C

Cresta

Hello
The code below is use to find any broken references and remove them. I have
proven it finds any 'MISSING' references but cannot remove them. It gives
error -2147319779 "Object Library not recognised"

Dim theRef As Variant, i As Long
On Error GoTo errorhandler:
For i = Application.VBE.activeVBProject.References.Count To 1 Step -1
Set theRef = Application.VBE.activeVBProject.References.Item(i)
If theRef.IsBroken = True Then
Application.VBE.activeVBProject.References.Remove (theRef)
End If
Next i

Anyone got any ideas on this.
Thanks
 

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