Sub MyMainMenu(
'main menu commandba
Dim cb As CommandBa
Dim ctr As CommandBarContro
Dim i As Lon
On Error Resume Nex
'pasek istnieje/commandbar exist
Set cb = CommandBars("MojPasekMenu"
'jeśli istnieje usuń, by na nowo go utworzyć/if exist then delete it and create new on
If Not cb Is Nothing Then UsunPasek "MojPasekMenu
On Error GoTo Err_MyMainMen
'utówrz nowy pasek/create new commandba
Set cb = CommandBars.Add("MojPasekMenu", msoBarTop, True, True) 'temporary menu ba
'utwórz nowy element typu menu rozwijane/create new commadbarcontrol type popu
Set ctr = cb.Controls.Add(msoControlPopup
With ct
.Caption = "Some
.TooltipText = .Captio
For i = 1 To
ctr.Controls.Add msoControlButto
Next
With ctr.Control
'1 el
.Item(1).Caption = "Nowy
.Item(1).TooltipText = .Item(1).Captio
.Item(1).FaceId = 18 'ikona nowy/icon ne
.Item(1).OnAction = "NewEle_Click" 'makro, które będzie uruchomione przy kliknięciu/macro to ru
'2 el
.Item(2).Caption = "Otwórz
.Item(2).TooltipText = .Item(2).Captio
.Item(2).FaceId = 23 'ikona otwórz/icon ope
.Item(2).OnAction = "OpenEle_Click" 'makro, które będzie uruchomione przy kliknięciu/macro to ru
'3 el
.Item(3).Caption = "Zamknij
.Item(3).TooltipText = .Item(3).Captio
.Item(3).FaceId = 106 'ikona zamknij/icon clos
.Item(3).OnAction = "CloseEle_Click" 'makro, które będzie uruchomione przy kliknięciu/macro to ru
End Wit
End Wit
cb.Visible = Tru
Exit_MyMainMenu
On Error Resume Nex
Set ctr = Nothin
Set cb = Nothin
Exit Su
Err_MyMainMenu
MsgBox Err.Description, vbExclamation, "BÅ‚Ä…d nr " & Err.Numbe
Resume Exit_MyMainMen
End Su
Sub MyToolBar(
'simple commandbar (not main menu
Dim cb As CommandBa
Dim ctr As CommandBarContro
On Error Resume Nex
Set cb = CommandBars("MojPasekNarz"
If Not cb Is Nothing Then UsunPasek "MojPasekNarz
On Error GoTo Err_MyToolBa
Set cb = CommandBars.Add("MojPasekNarz", msoBarTop
'1 el
Set ctr = cb.Controls.Add(msoControlButton
With ct
.Caption = "Nowy
.TooltipText = .Captio
.FaceId = 18 'nowy/ne
.OnAction = "NewEle_Click
End Wit
'2 el
Set ctr = cb.Controls.Add(msoControlButton
With ct
.Caption = "Otwórz
.TooltipText = .Captio
.FaceId = 23 'otwórz/ope
.OnAction = "OpenEle_Click
End Wit
'3 el
Set ctr = cb.Controls.Add(msoControlButton
With ct
.Caption = "Zamknij
.TooltipText = .Captio
.FaceId = 106 'zamknij/clos
.OnAction = "CloseEle_Click
End Wit
cb.Visible = Tru
Exit_MyToolBar
On Error Resume Nex
Set ctr = Nothin
Set cb = Nothin
Exit Su
Err_MyToolBar
MsgBox Err.Description, vbExclamation, "BÅ‚Ä…d nr " & Err.Numbe
Resume Exit_MyToolBa
End Su