Running a Ribbon command from a command button using vba

BiigJiim

Registered User.
Local time
Today, 06:04
Joined
Jun 7, 2012
Messages
114
Hi,

I would like to add a command button to a form which exactly mimics a particular ribbon command being clicked. Is there a vba command to run a ribbon command, and how do I find the list of ribbon commands available etc.?

Basically I want to exactly replicate what happens when you click the Export to Excel button on the External Data tab. (I know there are various vba commands; outputto, transferspeadsheet, docmd.runcommand accmdOutputTooExcel etc, but none of these do exactly what I want. I want to bring up the Export - Excel Spreadsheet dialog, so the user has some control.)

The ribbon on my app is hidden and I don't want to go down the route of customised ribbons etc.

Many thanks for any help,

Jim
 
Hi Jim. Try the RunCommand method.
 
Hi DBguy. I did try that - the problem is it doesn't open the dialog box to allow the user to name the output and specify the destination. It just automatically outputs with the form name as the file name into the My Documents folder.
 
Hi DBguy. I did try that - the problem is it doesn't open the dialog box to allow the user to name the output and specify the destination. It just automatically outputs with the form name as the file name into the My Documents folder.
Which one did you try?

Sent from phone...
 
Sorry for the late reply (only just got round to fixing this!) Worked a treat - thanks DBguy!
Hi. You're welcome. Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Back
Top Bottom