Solved

List of Access 2010 Shortcut Menu 'Magic' numbers

Posted on 2013-11-17
3
3,587 Views
Last Modified: 2013-11-17
I [previously posted a question asking how to create 'shortcut menus' in Access 2010 since the menu builder in Access 2003 was no longer available.  I got an excellent answer that works but it leads me to another question.  In the example the Cut, Copy and Paste options are added using the 'magic number' (21=Cut, 19=Copy, 22=Paste) technique.

There are many other built in Access functions that I would like to include in my menu's.  For example my shortcut menu on a report would have 'Print', 'Export' and possibly 'Email as an Attachment' options.  What are the magic numbers for these functions?

More generally where can I find a list of the magic numbers for Access functions?

Here is the code in the example I was given:
Public Function CreateCMenu()
On Error Resume Next

    CommandBars("MyContext").Delete

    Dim cmb As CommandBar 'Object
    Dim cmbBtn1 As CommandBarButton 'Object
    Dim cmbBtn2 As CommandBarButton 'Object

    Set cmb = CommandBars.Add("MyContext", _
               msoBarPopup, False, False)    ' msoBarPopup = 5
        With cmb
              ' add cut, copy, and paste buttons with the "magic number" technique that assigns
              ' appearance and behavior. The magic number goes in as the second parameter

            .Controls.Add msoControlButton, _
                  21, , , True  ' 21=Cut, msoControlButton=1
            .Controls.Add msoControlButton, _
                      19, , , True  '19= Copy
            .Controls.Add msoControlButton, _
                      22, , , True  ' 22=Paste

' add customized buttons with our caption and function name -- second param is blank
            Set cmbBtn1 = .Controls.Add(msoControlButton, _
                                    , , , True)
            With cmbBtn1
                .BeginGroup = True
                .Caption = "Create New"
                .OnAction = "=CreateNewOrder()"
                .FaceID = 59  'smiley face
            End With
           
            Set cmbBtn2 = .Controls.Add(msoControlButton, _
                                    , , , True)
            With cmbBtn2
                .Caption = "Reset"
                .OnAction = "=ClearOrder()"
            End With
        End With

   
End Function

Open in new window

0
Comment
Question by:mlcktmguy
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
MacroShadow earned 250 total points
ID: 39654695
Download the file at http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=6627 once extracted, you will find what you're looking in an Excel file named AccessControls
0
 
LVL 1

Author Comment

by:mlcktmguy
ID: 39654979
Thank you.  I found all that I was looking for except 'Export..."  In Access 2003 this menu option would pop up a new menu listing all the export formats to choose from.

I found specific exports "Export Excel', 'Export Word' etc.. but nothing similar to the old option.  Maybe it doesn't exist in the new version of Access.  If by chance you know what the numeric equivalent is, please let me know.

In case anyone else is interested, these are the ones I found in the list and put into a right click menu that users will see when a report is previewed.

            .Controls.Add msoControlButton, _
                      15948, , , True  ' 15948  - Print... with Dialog menu
            .Controls.Add msoControlButton, _
                      2521, , , True  ' 2521  - File Print Quick
                     
             .Controls.Add msoControlButton, _
                      12951, , , True  ' 12951 - Publish to PDF or EDoc
                 
     
            .Controls.Add msoControlButton, _
                      11723, , , True  ' 11723  Export To Excel
            .Controls.Add msoControlButton, _
                      11725, , , True  ' 11725 - Export to Word                      
            .Controls.Add msoControlButton, _
                      2188, , , True  ' 2188 File Send as attachment
0
 
LVL 1

Author Closing Comment

by:mlcktmguy
ID: 39654980
Excellent
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Documents and settings folder 30 76
Access 2016 - query 23 57
Modal form 11 29
Why get error when delete all records on a sub-form 2 15
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

806 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question