Missing Reference

D

Dib

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

Please help with sample
Thanks
Dib
 
D

Douglas J. Steele

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top