Skip to main content

AccessTr.neT


Sağ Click İle Oluşturulan Menulerin İd Değerlemeleri

Sağ Click İle Oluşturulan Menulerin İd Değerlemeleri

#7
Kod:
Sub CreateSimpleShortcutMenu()
    Dim cmbShortcutMenu As Office.CommandBar
     
    ' Create a shortcut menu named "SimpleShortcutMenu.
    Set cmbShortcutMenu = CommandBars.Add("SimpleShortcutMenu", msoBarPopup, False, True)
     
    ' Add the Remove Filter/Sort command.
    cmbShortcutMenu.Controls.Add Type:=msoControlButton, Id:=605

    ' Add the Filter By Selection command.
    cmbShortcutMenu.Controls.Add Type:=msoControlButton, Id:=640
     
    Set cmbShortcutMenu = Nothing
     
End Sub


Kod:
Sub CreateShortcutMenuWithGroups()
    Dim cmbRightClick As Office.CommandBar

' Create the shortcut menu.
    Set cmbRightClick = CommandBars.Add("cmdFormFiltering", msoBarPopup, False, True)
     
    With cmbRightClick
        ' Add the Find command.
        .Controls.Add msoControlButton, 141, , , True
         
        ' Start a new grouping and add the Sort Ascending command.
        .Controls.Add(msoControlButton, 210, , , True).BeginGroup = True
         
        ' Add the Sort Descending command.
        .Controls.Add msoControlButton, 211, , , True
         
        ' Start a new grouping and add the Remove Filer/Sort command.
        .Controls.Add(msoControlButton, 605, , , True).BeginGroup = True
         
        ' Add the Filter by Selection command.
        .Controls.Add msoControlButton, 640, , , True
         
        ' Add the Filter Excluding Selection command.
        .Controls.Add msoControlButton, 3017, , , True
         
        ' Add the Between... command.
        .Controls.Add msoControlButton, 10062, , , True
    End With

Set cmbRightClick = Nothing
End Sub


Kod:
Sub CreateReportShortcutMenu()
    Dim cmbRightClick As Office.CommandBar
    Dim cmbControl As Office.CommandBarControl

   ' Create the shortcut menu.
    Set cmbRightClick = CommandBars.Add("cmdReportRightClick", msoBarPopup, False, True)

    With cmbRightClick
         
        ' Add the Print command.
        Set cmbControl = .Controls.Add(msoControlButton, 2521, , , True)
        ' Change the caption displayed for the control.
        cmbControl.Caption = "Quick Print"
         
        ' Add the Print command.
        Set cmbControl = .Controls.Add(msoControlButton, 15948, , , True)
        ' Change the caption displayed for the control.
        cmbControl.Caption = "Select Pages"
         
        ' Add the Page Setup... command.
        Set cmbControl = .Controls.Add(msoControlButton, 247, , , True)
        ' Change the caption displayed for the control.
        cmbControl.Caption = "Page Setup"
         
        ' Add the Mail Recipient (as Attachment)... command.
        Set cmbControl = .Controls.Add(msoControlButton, 2188, , , True)
        ' Start a new group.
        cmbControl.BeginGroup = True
        ' Change the caption displayed for the control.
        cmbControl.Caption = "Email Report as an Attachment"
         
        ' Add the PDF or XPS command.
        Set cmbControl = .Controls.Add(msoControlButton, 12499, , , True)
        ' Change the caption displayed for the control.
        cmbControl.Caption = "Save as PDF/XPS"
         
        ' Add the Close command.
        Set cmbControl = .Controls.Add(msoControlButton, 923, , , True)
        ' Start a new group.
        cmbControl.BeginGroup = True
        ' Change the caption displayed for the control.
        cmbControl.Caption = "Close Report"
    End With
     
    Set cmbControl = Nothing
    Set cmbRightClick = Nothing
End Sub

@benbendedeilem
Son Düzenleme: 03/05/2020, 08:37, Düzenleyen: accessman.
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da
Task