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

         

Capt As String) As CommandBarControl


Public Function MyFindControl( Capt As String) As CommandBarControl 'Поиск по заголовку 'Возвращает в качестве результата первый элемент с указанным заголовком Dim bar As CommandBar Dim Ctr As CommandBarControl Dim i As Integer For i = 1 To 9 Select Case i Case 1 Set bar = CommandBars("File") Case 2 Set bar = CommandBars("Edit") Case 3 Set bar = CommandBars("View") Case 4 Set bar = CommandBars("Insert") Case 5 Set bar = CommandBars("Format") Case 6 Set bar = CommandBars("Tools") Case 7 Set bar = CommandBars("Table") Case 8 Set bar = CommandBars("Window") Case 9 Set bar = CommandBars("Help") End Select For Each Ctr In bar.Controls If Ctr.Caption = Capt Then Set MyFindControl = Ctr Exit Function End If Next Ctr Next i For Each bar In CommandBars 'Debug.Print bar.name For Each Ctr In bar.Controls If Ctr.Caption = Capt Then Set MyFindControl = Ctr Exit Function End If Next Ctr Next bar End Function
Листинг 3.2.
Закрыть окно
Содержание раздела