ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Breaking a Reference Error (https://www.excelbanter.com/excel-programming/415178-breaking-reference-error.html)

Cresta

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


All times are GMT +1. The time now is 09:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com