View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Cresta Cresta is offline
external usenet poster
 
Posts: 76
Default Breaking a Reference Error

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