Running a Ribbon command from a command button using vba (1 Viewer)

BiigJiim

Registered User.
Local time
Today, 23:38
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
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:38
Joined
Oct 29, 2018
Messages
21,473
Hi Jim. Try the RunCommand method.
 

BiigJiim

Registered User.
Local time
Today, 23:38
Joined
Jun 7, 2012
Messages
114
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.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:38
Joined
Oct 29, 2018
Messages
21,473
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...
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:38
Joined
Oct 29, 2018
Messages
21,473
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

Top Bottom