Software Developer's Kit - ChemDraw

Send comments on this topic
Captions Property
See Also 


Member of ChemDraw Control.AltGroup.

Returns the captions in this AltGroup.

Property type

Read-only property


Visual Basic
Public Property Captions() As Captions

Return Type


This property refers to the collection of captions which is within this AltGroup. The members of this collection will be the captions in this AltGroup. The properties associated with the collection are the following:

myAltGroup.Captions.Application      returns the application associated with the collection of captions
myAltGroup.Captions.Count             returns the number of captions in the collection of captions
myAltGroup.Captions.Item(i)           returns one caption from the collection of captions 
myAltGroup.Captions.Parent            returns the parent of the collection of captions

With AltGroup.Captions.Item(i) all the caption properties are enabled for caption(i). This index starts with 1.


'Captions collection of this AltGroup 
 Dim MyAltGroup As ChemDrawControl10Ctl.AltGroup
 Private Sub ChemDrawControl10Ctl_SelectionChanged(ByVal selection As ChemDrawControl10Ctl.IChemDrawSelection)
     If  ChemDrawControl10Ctl.Objects.AltGroups.Count = 1 Then 'Checks if an AltGroup has been drawn
         Set MyAltGroup = ChemDrawControl10Ctl.AltGroups.Captions.Item(1)
         Command1.Enabled = True
         Command1.Enabled = False
     End If 
 End Sub
 Private Sub Command1_Click()
     MyAltGroup.Caption.Angle = Val(Text1.Text)
     Text1.Text = MyAltGroup.Caption.Angle 'reads the caption angle
     vMessage = InputBox("Change the Text", "[Variable].Caption.text", MyAltGroup.Caption.Text)
     MyAltGroup.Caption.Text = vMessage 'changes the Title of the caption
     MyAltGroup.Caption.Color = &HFF '&HFF is red in hex
     MyAltGroup.Caption.Color = vbBlue 'this is blue in VB code
 End Sub
 Private Sub Command1_Click()
     vMessage = MsgBox("The alt group has " & MyAltGroup.Captions.Count & " Caption/s", _
                vbInformation + vbOKOnly, "Info")
 End Sub

See Also