I have excel that is use by many users. Some of them do not have installed all software's and therefore missing references. I am, trying to have script that remove all references that can not be found on C: drive.
I have this code in /Microsoft Excel Objects / ThisWorkbook but is not fully working. Anyone could help me with this.
Sub TestRef()
Dim REF As VBIDE.Reference
Dim WB As Workbook
Set WB = ThisWorkbook
For Each REF In WB.VBProject.References
If StrComp(Left(REF.FullPath, 1), "C", vbTextCompare) <> 0 Then
DelRef
Debug.Print REF.Name, REF.Description, REF.FullPath
End If
Next REF
End Sub
Sub DelRef()
Dim REF As VBIDE.Reference
Dim WB As Workbook
Set WB = ThisWorkbook
With ThisWorkbook.VBProject.References
.Remove .Item("MSForms")
End With
End Sub