Missing Reference

  • Thread starter Thread starter Dib
  • Start date Start date
D

Dib

Hi,
Is there a way to remove (Uncheck) a missing reference using code?

Please help with sample
Thanks
Dib
 
From the Help file. The following code will remove the reference to the
Calendar control (MSACAL)

Function RemoveReference() As Boolean

Dim ref As Reference

On Error GoTo Error_RemoveReference
Set ref = References!MSACAL
References.Remove ref
RemoveReference = True

Exit_RemoveReference:
Exit Function

Error_RemoveReference:
MsgBox Err & ": " & Err.Description
RemoveReference = False
Resume Exit_RemoveReference
End Function


You should be able to loop through all of the references in the collection,
removing broken ones using code like:

Sub RemoveBrokenReference()

Dim ref As Reference

' Enumerate through References collection.
For Each ref In References
' Check IsBroken property.
If ref.IsBroken = True Then
References.Remove ref
EndIf
Next ref
End Sub
 
Back
Top