AnnLock example for Visual Basic

Note: Also works with Access 95 and 97.

Note: This topic is for Document/Medical only.

This example locks objects of type ANNOBJECT_ELLIPSE using the key "IkeStarnes".

Dim nType As Integer
Dim a As Integer
Dim bSelected As Boolean
Dim uCount As Integer
Dim aObjects As Variant 'array for the selected object handles
    
    'lock only the ellipse objects that are selected
    
    bSelected = False
    uCount = Lead1.AnnGetSelectCount  'get number of selected objects
    aObjects = Lead1.AnnGetSelectList 'get the handles of the selected objects
    For a = 1 To uCount
        nType = Lead1.AnnGetType(aObjects(a - 1))
        If nType = ANNOBJECT_ELLIPSE Then  'Is the object an ellipse?
            bSelected = True
            Lead1.AnnLock aObjects(a - 1), "IkeStarnes", False
        End If
    Next

    If bSelected <> True Then
        MsgBox "No Ellipse Objects were selected"
    End If