Software Developer's Kit - ChemDraw

Send comments on this topic
Count Property
See Also 

Description

Member of ChemDrawControl.Objects.

Returns the number of objects in the objects collection.

Property type

Read-only property

Syntax

Visual Basic
Public Property Count() As Long

Return Type

Long

Example

'Shows number of objects within the ChemDraw document  
 Private Sub cmdCommand_Click() 
     Dim myObject1 as ChemDrawControl10Ctl.Object
     Dim myObject2 as ChemDrawControl10Ctl.Object 
    'Checks if at least two Objects have been drawn
     If  ChemDrawControl10Ctl.Objects.Count > 2 Then 
         Set MyObject1 = ChemDrawControlCtl.Objects.Item(1)
         Set MyObject2 = ChemDrawControlCtl.Objects.Item(2)
        'Returns the number of Objects within the ChemDraw document
         Text1.text = "There are: " & format(ChemDrawControl10Ctl.Objects.Count, "##") & " object/s" 
     End If
 End Sub

See Also