Sub Макрос1()
Dim i As Long, aBars() As Boolean
On Error GoTo er
ReDim aBars(1 To Application.CommandBars.Count)
For i = 1 To Application.CommandBars.Count
aBars(i) = Application.CommandBars(i).Enabled
Application.CommandBars(i).Enabled = False
Next
MsgBox "Вуаля!"
er:
For i = 1 To Application.CommandBars.Count
Application.CommandBars(i).Enabled = aBars(i)
Next
End Sub
Sub cbars_click
Dim i
Dim aBars
Dim objInsp
Dim colCB
Dim objCBB
On Error Resume Next
Set objInsp = Item.GetInspector
Set colCB = objInsp.CommandBars
for i=1 to colCB.count
' msgbox i
set aBars(i) = colCB(i).Enabled
colCB(i).Enabled = False
next
Set objCBB = Nothing
Set colCB = Nothing
Set objInsp = Nothing
End Sub
Сейчас этот форум просматривают: Yandex-бот и гости: 62