Tomas Rutkauskas
How to add an item to the menu in Word
Answer:
1 { ... }2 var3 CBar: CommandBar;
4 MenuItem: OleVariant;
5 { ... }6 7 { Add an item to the File menu }8 CBar := Word.CommandBars['File'];
9 MenuItem := CBar.Controls.Add(msoControlButton, EmptyParam, EmptyParam,
10 EmptyParam, True) as CommandBarButton;
11 MenuItem.Caption := 'NewMenuItem';
12 MenuItem.DescriptionText := 'Does nothing';
13 {Note that a VB macro with the right name must exist before you assign it to the 14 item!}15 MenuItem.OnAction := 'VBMacroName';
16 { ... }