AddSeparator Method

Adds a separator to an existing menu or toolbar.

See Also | Example


RetVal = object.AddSeparator(Index)


PopupMenu, Toolbar
The object or objects this method applies to.


Variant; input-only
The index location in the menu or toolbar where the item is to be added.

If an integer is used to specify a given location in the menu or toolbar, the index must be between 1 and N-1, where N is the number of objects in the popup menu or in the toolbar. The separator will be added immediately before the specified index location. To add the separator to the end of a menu or toolbar, set the index to be greater than N.

If a string is specified and the indexed item does not exist, then the separator is added at the end of the menu or toolbar.


PopupMenuItem object or ToolbarItem object
The newly created separator item.


The first item in a menu or toolbar cannot be a separator, therefore you cannot add a separator into index position 0.

You cannot add a separator immediately next to another separator.