Solved

List of Access 2010 Shortcut Menu 'Magic' numbers

Posted on 2013-11-17
3
3,512 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

863 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now