Opening the print Dialog in VBA

smig

Registered User.
Local time
Today, 22:03
Joined
Nov 25, 2009
Messages
2,209
I'm creating my oun ribbon
Right now the Print and Page Setup Dialogs are used "As Is"

Code:
<group id="grpReports2" label=" ">
	<button idMso="PrintDialogAccess"
		size="large"
		label="Print"/>
	<button idMso="PageSetupDialog"
		size="large"
		label="Page Setup"/>

I want to open these dialogs using VBA so I can have some more action before/after printing.
 
Hi. In your Ribbon Callback, try the following command.

DoCmd.RunCommand acCmdPrint
 
Hi. In your Ribbon Callback, try the following command.

DoCmd.RunCommand acCmdPrint
Thanks,

And what about the Page Setup Dialog ?
 
I recommend you look at the various tutorials at the Access Ribbon Creator site run by Gunter Avenius: https://www.accessribbon.de/

You can also download a trial version of his ribbon creator utility or purchase the full version. It will probably save you a lot of time
 
I recommend you look at the various tutorials at the Access Ribbon Creator site run by Gunter Avenius: https://www.accessribbon.de/

You can also download a trial version of his ribbon creator utility or purchase the full version. It will probably save you a lot of time
Thanks, but I have a very nice working ribbon :)

I only need some help for the correct commands to run the Print dialog and Page Setup Dialog from VBA.
 
That's why I suggested you look at the tutorials on that site
 
Nor mine - it has an English version! :D
Translate option at top right
 
in the FAQ he say to use:
Application.CommandBars.ExecuteMso ("idMSO")

is it better then using the
DoCmd.RunCommand
?
 
It is my understanding it is better to use RunCommand whenever possible. The only time I have seen need to resort to the old CommandBars is for RefreshAll.

CommandBars.ExecuteMso "DataRefreshAll"

So the ribbon has nothing to do with what you want to accomplish?
 
Last edited:
I'm not the best person to answer your specific question.
I have several apps where I remove the application window, ribbon, nav pane etc. However when a report is opened the print preview ribbon is shown. When the report is closed the ribbon is removed once again

You can see an example of this in action at: https://www.access-programmers.co.uk/forums/showthread.php?t=293584.
The latest version is in post #10
Click the Open New Form button then click View Report

As this is so easy, I've never felt the need to do a custom print ribbon

I also have a number of apps where I remove the default ribbons and add my own custom ribbon. For example:

attachment.php


As I only do it once a year I tend to use the free version of the Ribbon Creator tool.
 

Attachments

  • RibbonExample.PNG
    RibbonExample.PNG
    21.3 KB · Views: 2,354
In my app I use my oun ribbons, and they work perfectly.
I hide them and show them when I need.

The only commands I left original are the Print Dialog and the Page Setup Dialog.

I changed now the Print Dialog as I needed to run some code to set the paper as printed (Set invoices and receipts as printed) :)
 

Users who are viewing this thread

Back
Top Bottom