Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access 2010 - shortcut right click menu for reports

Posted on 2013-11-10
5
Medium Priority
?
3,054 Views
Last Modified: 2013-11-11
I am using the lovely code snippet provied by Microsoft to set up a right click report menu.  All good.  The client now wants to add the option to export to Excel.  Does anyone know the correct bit of code such as .Controls.Add(msoControlButton, 2521) for this option?
Sub CreateReportShortcutMenu()
    'for runtime versions, report preview right click option to print is not available,
    'so we need to create a shortcut menu bar here and then assign it in each report property sheet "Shortcut menu bar"
    'just need to create once - can run from immediate window by 'call CreateReportShortcutMenu'
    'can't seem to delete so if you need to change, you will need to create new one with different name
    'to delete - try commandbars.item("xxx").delete
    
    Dim cmbRightClick As Office.CommandBar
    Dim cmbControl As Office.CommandBarControl

    Set cmbRightClick = CommandBars.Add("cmdReportsRightClick2", _
                                        msoBarPopup, False, False)
    With cmbRightClick
        
        ' Add the Print command.
        Set cmbControl = .Controls.Add(msoControlButton, 2521)
        ' Change the caption displayed for the control.
        cmbControl.Caption = "Quick Print"
        
        ' Add the Print command.
        Set cmbControl = .Controls.Add(msoControlButton, 15948)
        ' Change the caption displayed for the control.
        cmbControl.Caption = "Print ..."
        
        ' Add the Page Setup... command.
        Set cmbControl = .Controls.Add(msoControlButton, 247)
        ' Change the caption displayed for the control.
        cmbControl.Caption = "Page Setup ..."
        
        ' Add the Mail Recipient (as Attachment)... command.
        Set cmbControl = .Controls.Add(msoControlButton, 2188)
        ' 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)
        ' Change the caption displayed for the control.
        cmbControl.Caption = "Save as PDF/XPS"
        
        ' Add the Close command.
        Set cmbControl = .Controls.Add(msoControlButton, 923)
        ' 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

Open in new window

0
Comment
Question by:MonkeyPie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 39638412
Get this, from the Microsoft Download Center:
http://www.microsoft.com/en-us/download/confirmation.aspx?id=6627

It has all of the mso ID's, organized by product.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39638421
If you look in the spreadsheet for Access, I think the one you are looking for is just "ExportExcel".  You would add them to a ribbon using the Name, but for your command bar coding, the numbers listed on the right might be what you need (not sure), so try 2862.
0
 

Author Comment

by:MonkeyPie
ID: 39640661
Thank you mbizup,  but I need a bit more help here.  I have done as you suggest and downloaded the Office 2010 Help Files: Office Fluent User Interface Control Identifiers.  Microsoft's 'Instructions for Use' are less than helpful ...
'After you have installed this download, view the files using Excel 2007 or Excel 2010 as you normally would'  !!

So, I opened EXCEL and went to HELP.  Searched for various things 'Interface Control Identifiers' etc.  Got no-where.  Tried the same thing in Access.

What exactly do they mean when they say... view the files using Excel 2007 or Excel 2010 as you normally would?

Also, I'm not sure what you mean by..
If you look in the spreadsheet for Access, I think the one you are looking for is just "ExportExcel".  You would add them to a ribbon using the Name, but for your command bar coding, the numbers listed on the right might be what you need (not sure), so try 2862.

What is the 'spreadsheet for Access'?  What numbers listed on the right?

Thank you for your help.
0
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 39640677
That installation file basically unzips a whole bunch of excel files into a default folder or a folder of your choosing.  The filenames indicate which office product each file applies to, and you can open them to see the control names, ids and other info.
0
 

Author Closing Comment

by:MonkeyPie
ID: 39640688
Ah!  Thank you.  I see in the AccessControls.xlxs the one ExportExcel is number 11723.  I'll give that a go.  Thank especially for quick response.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

650 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