RunTime Error-:object library not registered

nithinkm

Board Regular
Joined
May 7, 2008
Messages
70
Hi

Im using this piece of code to remove Missing references. But it shows error on this. The error is
"RunTime Error-'2147319779(8002801d)':eek:bject library not registered"

Tyhe error shows on "ThisWorkbook.VBProject.References.Remove theRef"
code
====
Dim theRef As Variant, i As Long

For i = ThisWorkbook.VBProject.References.Count To 1 Step -1
Set theRef = ThisWorkbook.VBProject.References.Item(i)
If theRef.isbroken = True Then
ThisWorkbook.VBProject.References.Remove theRef
End If
Next i

If Err <> 0 Then
Call MakeMessages("A missing reference has been encountered!You will need to remove the reference manually", "Reference Alert", vbCritical)

End If

Please help
Thanks in advance
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
This code runs, but I do not know if it does what it is supposed to do.
To test it properly I would need to introduce some errors - which I do not have time for.
Code:
Sub UNTESTED()
    Dim theRef As Variant, i As Long
    On Error Resume Next            ' ADDED LINE
    '-------------------------------------------------------------------------
    '- loop
    For i = ThisWorkbook.VBProject.References.Count To 1 Step -1
        Set theRef = ThisWorkbook.VBProject.References.Item(i)
        If theRef.isbroken = True Then
            ThisWorkbook.VBProject.References.Remove theRef
            '-----------------------------------------------------------------
            '- CHECK FOR ERROR
            If Err.Number <> 0 Then
                rsp = MsgBox(theRef.Description & _
                    "A missing reference has been encountered!You will need to remove it manually", _
                    "Reference Alert", vbCritical)
            End If
            '------------------------------------------------------------------
        End If
    Next i
    '--------------------------------------------------------------------------
    MsgBox ("Done")
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,893
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top