Software Developer's Kit - ChemDraw

Send comments on this topic
Add Method
See Also 
Caption
The caption of the menu object being added to the collection
beforeIndex
Indicates the position where the menu item will be added.

Description

Member of ChemDraw Control.Menus.

Adds a menu to the collection of menus

Syntax

Visual Basic
Public Function Add( _
   ByVal Caption As String, _
   ByRef beforeIndex As Variant _
) As Object

Parameters

Caption
The caption of the menu object being added to the collection
beforeIndex
Indicates the position where the menu item will be added.

Example

Private Sub cmdApplication_click()
   'Declares variables 
    Dim myMenu As ChemDrawControl11Ctl.Menu
    Dim myMenus As ChemDrawControl11Ctl.Menus
    Dim myMenuBar As ChemDrawControl11Ctl.MenuBar
    Dim myMenuBars As ChemDrawControl11Ctl.MenuBars
    Dim myMenuItem As ChemDrawControl11Ctl.MenuItem
    Dim myMenuItems As ChemDrawControl11Ctl.MenuItems
   'Returns number of MENU BARS 
    Text1.Text = "menuBars " & ctlChemDraw.Application.MenuBars.Count
    Set myMenuBar = ctlChemDraw.Application.MenuBars.Item(1)  
    'Returns number of MENUS 
    Text2.Text = "menus " & myMenuBar.Menus.Count
    Set myMenus = myMenuBar.Menus  
    myMenus.Add "Menu Caption", 3
    ctlChemDraw.UpdateMenus
    Text3.Text = myMenus.Item(3).Caption
    myMenus.Remove 3
    ctlChemDraw.UpdateMenus
   'Returns menus properties 
    Text4.Text = myMenus.Application
    Text5.Text = myMenu.Count
End Sub

See Also