Predmet:Re: Acces2010 i skočni meni
Evo našao sam i ovo možda nekom zatreba za Shortcat menu u access 2010.
Ovo ubaciti u neki modul:
PreuzmiIzvorni kôd (Text):Sub CreateContextMenu()
Dim cbr As CommandBar
Dim cbb As CommandBarButton
' Delete the command bar if it already exists
DeleteContextMenu
' Create a new command bar of type msoBarPopup
Set cbr = CommandBars.Add(Name:="MyBar", Position:=msoBarPopup)
With cbr
' Add first item
Set cbb = .Controls.Add(type:=msoControlButton)
With cbb
.Caption = "Item 1"
.Style = msoButtonCaption
.OnAction = "MyFunc1"
End With
' Add second item
Set cbb = .Controls.Add(type:=msoControlButton)
With cbb
.Caption = "Item 2"
.Style = msoButtonCaption
.OnAction = "MyFunc2"
End With
' Add third item
Set cbb = .Controls.Add(type:=msoControlButton)
With cbb
.Caption = "Item 3"
.Style = msoButtonCaption
.OnAction = "MyFunc3"
End With
' Add fourth item
Set cbb = .Controls.Add(type:=msoControlButton)
With cbb
.Caption = "Item 4"
.Style = msoButtonCaption
.OnAction = "MyFunc4"
End With
End With
End Sub
' Delete the shortcut menu
Sub DeleteContextMenu()
On Error Resume Next
CommandBars("MyBar").Delete
End Sub
' These functions are executed by the shortcut menu items
Function MyFunc1()
MsgBox "This is MyFunc1", vbInformation
End Function
Function MyFunc2()
MsgBox "This is MyFunc2", vbInformation
End Function
Function MyFunc3()
MsgBox "This is MyFunc3", vbInformation
End Function
Function MyFunc4()
MsgBox "This is MyFunc4", vbInformation
End Function
Zatim izabrati na propertis forme Shortcat menu:MyBar
Miro