Solved

Access 2010 - shortcut right click menu for reports

Posted on 2013-11-10
5
2,942 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 500 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Can not open the Access Help ? 3 37
Update Table via VBA SQL with multiple criteria 2 67
CISCO WIFI 6 72
Tabbed form question 5 18
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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…

734 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