Set ГлМеню = CommandBars.Add(Name:="MyMenu1") выдает ошибку runtime error 5 invalid procedure call or argument помогите кто знает програмируем в вижуалке через excel
зарание спасибо!!!!
Sub Mymenu()
Dim ГлМеню As Object
Dim ПМеню As Object, ПМеню1 As Object, ПМеню2 As Object, ПМеню3 As Object
Application.CommandBars("Formatting").Visible = False
Set ГлМеню = CommandBars.Add(Name:="MyMenu1")
Set ПМеню = ГлМеню.Controls.Add(Type:=msoControlPopup)
ПМеню.Caption = "Клиенты"
Set ПМеню1 = ПМеню.CommandBar.Controls.Add(Type:=msoControlButton)
With ПМеню1
Caption = "Добавить"
OnAction = "Add"
End With
Set ПМеню2 = ПМеню.CommandBars.Controls.Add(Type:=msoControlButton)
With ПМеню2
Caption = "Изменить"
OnAction = "Che"
End With
Set ПМеню3 = ПМеню.CommandBars.Controls.Add(Type:=msoControlButton)
With ПМеню3
Caption = "Удалить"
OnAction = "Del"
End With
Set ПМеню = ГлМеню.Controls.Add(Type:=msoControlPopup)
ПМеню.Caption = "Расценки"
Set ПМеню1 = ПМеню.CommandBars.Controls.Add(Type:=msoControlButton)
With ПМеню1
.Caption = "Поменять"
.OnAction = "Zam"
End With
Set ПМеню = ГлМеню.Controls.Add(Type:=msoControlPopup)
ПМеню.Caption = "Касса"
Set ПМеню1 = ПМеню.CommandBar.Controls.Add(Type:=msoControlButton)
With ПМеню1
Caption = "Оплатить"
OnAction = "Opl"
End With
Set ПМеню2 = ПМеню.CommandBars.Controls.Add(Type:=msoControlButton)
With ПМеню2
Caption = "Показать"
OnAction = "Pok"
End With
Set ПМеню = ГлМеню.Controls.Add(Type:=msoControlButton)
With ПМеню
.style="msoButtonCaption"
.Caption = "Выход"
.OnAction = "DelMyMenu"
End With
With ГлМеню
.Visible = True
.Potection = msoBarNoMove
End With
End Sub
Sub DeleteMyMenu()
Application.CommandBars("Formatting").Visible = True
CommandBars("MyMenu1").Delete
End Sub