detaching references with Display Off


I found a .mvba that detaches all references that are turned off or missing.  What I need is to keep the missing ones that are turned on, or in otherwords, I only want to detach the references that are turned off.

Here is the .mvba that detaches all the off and missing references:
Sub detachDisplayOff()

For Each Attachment In

    Set currentRef = Attachment

    If currentRef.ElementsVisible = False Then
        Dim attParent As ModelReference
        Set attParent =
        attParent.Attachments.Remove currentRef
    End If



End Sub

According to the webiste:
"Note: because of the way MicroStation's attachment objects are structured, this will detach
all references that have Display switched off and any reference that cannot be found
(ie show in the Reference dialogue box in red). If you want to get clever and ignore the
missing references you'll have to add a check on the value of .isMissingModel. " 
I'm just wondering if anyone can edit this .mvba to use this .isMissingModel, as I have
no idea what the code is.