Hello,
I've been building a piece of code which uses a unique Reference Library, which isn't available on all the computers we'll be using to run the model. When the reference library is "MISSING", code which has no reference to the library is breaking. I can't go back through the thousands of line of code and dim/redim everything, and I can't get the code posted on this site previously to work. Here is what I'm using:
<code>
On Error Resume Next
Dim theRef As Variant
Dim removalRef 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
ThisWorkbook.VBProject.References.Remove removalRef
</code>
I have this in the workbook_open function, and though it moves through the error (on error resume next), it keeps my "MISSING' reference libraries.
Can someone help me?
I've been building a piece of code which uses a unique Reference Library, which isn't available on all the computers we'll be using to run the model. When the reference library is "MISSING", code which has no reference to the library is breaking. I can't go back through the thousands of line of code and dim/redim everything, and I can't get the code posted on this site previously to work. Here is what I'm using:
<code>
On Error Resume Next
Dim theRef As Variant
Dim removalRef 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
ThisWorkbook.VBProject.References.Remove removalRef
</code>
I have this in the workbook_open function, and though it moves through the error (on error resume next), it keeps my "MISSING' reference libraries.
Can someone help me?