Prikazi cijelu temu 12.11.2013 12:56
miro35 Van mreze
Clan
Registrovan od:05.01.2009
Lokacija:-


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):
  1. Sub CreateContextMenu()
  2.     Dim cbr As CommandBar
  3.     Dim cbb As CommandBarButton
  4.     ' Delete the command bar if it already exists
  5.     DeleteContextMenu
  6.     ' Create a new command bar of type msoBarPopup
  7.     Set cbr = CommandBars.Add(Name:="MyBar", Position:=msoBarPopup)
  8.     With cbr
  9.         ' Add first item
  10.         Set cbb = .Controls.Add(type:=msoControlButton)
  11.         With cbb
  12.             .Caption = "Item 1"
  13.             .Style = msoButtonCaption
  14.             .OnAction = "MyFunc1"
  15.         End With
  16.         ' Add second item
  17.         Set cbb = .Controls.Add(type:=msoControlButton)
  18.         With cbb
  19.             .Caption = "Item 2"
  20.             .Style = msoButtonCaption
  21.             .OnAction = "MyFunc2"
  22.         End With
  23.         ' Add third item
  24.         Set cbb = .Controls.Add(type:=msoControlButton)
  25.         With cbb
  26.             .Caption = "Item 3"
  27.             .Style = msoButtonCaption
  28.             .OnAction = "MyFunc3"
  29.         End With
  30.         ' Add fourth item
  31.         Set cbb = .Controls.Add(type:=msoControlButton)
  32.         With cbb
  33.             .Caption = "Item 4"
  34.             .Style = msoButtonCaption
  35.             .OnAction = "MyFunc4"
  36.         End With
  37.     End With
  38. End Sub
  39.  
  40. ' Delete the shortcut menu
  41.  
  42. Sub DeleteContextMenu()
  43.     On Error Resume Next
  44.     CommandBars("MyBar").Delete
  45. End Sub
  46.  
  47. ' These functions are executed by the shortcut menu items
  48.  
  49. Function MyFunc1()
  50.     MsgBox "This is MyFunc1", vbInformation
  51. End Function
  52.  
  53. Function MyFunc2()
  54.     MsgBox "This is MyFunc2", vbInformation
  55. End Function
  56.  
  57. Function MyFunc3()
  58.     MsgBox "This is MyFunc3", vbInformation
  59. End Function
  60.  
  61. Function MyFunc4()
  62.     MsgBox "This is MyFunc4", vbInformation
  63. End Function
Zatim izabrati na propertis forme Shortcat menu:MyBar
Miro