Software Developer's Kit - ChemDraw

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

Description

Member of ChemDraw Control.MenuItems.

Adds a menu item to the collection of menu items

Syntax

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

Parameters

Caption
The caption of the menu item being added.
beforeIndex
Indicates the position where the menu item will be added.
objectName
Name of the object.
itemType
Type of item.

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 myMenu = myMenuBar.Menus.Item(1) 
   'Returns number of MENU ITEMS 
    Text6.Text = "menuItems " & myMenu.MenuItems.Count
    Set myMenuItem = myMenu.MenuItems.Item(1)   
    Set myMenuItems = myMenuBar.Menus.Item(1).MenuItems   
    myMenuItems.Add "Menu Caption", 3
    ctlChemDraw.UpdateMenus
    Text3.Text = myMenuItems.Item(3).Caption
    myMenuItems.Remove 3
    ctlChemDraw.UpdateMenus
   'Returns menus properties 
    Text4.Text = myMenuItems.Application
    Text5.Text = myMenuItems.Count

End Sub

See Also