Основы офисного программирования и документы Word


Panel As String, MenuName As


Public Sub AddBuiltinMenu( Panel As String, MenuName As String, _ Num As Variant, item As CommandBarPopup) 'Добавляет встроенный пункт меню с именем MenuName 'на панель Panel Dim bar As CommandBar, ider As Variant Dim Ctrl As CommandBarControl Set bar = CommandBars(Panel) If Not ExistControl(bar, MenuName) Then Set Ctrl = MyFindControl(MenuName) 'Если найден If Not (Ctrl Is Nothing) Then ider = Ctrl.ID bar.Controls.Add Type:=msoControlPopup, _ ID:=ider, Before:=Num Else: Exit Sub End If End If Set item = bar.Controls(MenuName) End Sub
Листинг 3.8.
Закрыть окно
Содержание раздела