Don't ask the user if they want to _print

ARW17

Board Regular
Joined
Oct 31, 2016
Messages
109
I have a button for the user to print a few different forms filtered different ways. I use the following code to change the filtering and print the different pages then close them.

Application.Echo False
DoCmd.SetWarnings False


cDept = Null


cDept = "OPS"
SFMgmtMyDept.Requery
DoCmd.OpenForm "MyDeptRosterMgmtAM", , , , , acHidden
DoCmd.RunCommand acCmdPrint
DoCmd.OpenForm "MyDeptRosterMgmtPM", , , , , acHidden
DoCmd.RunCommand acCmdPrint
DoCmd.Close acForm, "MyDeptRosterMgmtAM", acSaveYes
DoCmd.Close acForm, "MyDeptRosterMgmtPM", acSaveYes


cDept = Null


cDept = "PCC"
SFMgmtMyDept.Requery
DoCmd.OpenForm "MyDeptRosterMgmtAM", , , , , acHidden
DoCmd.RunCommand acCmdPrint
DoCmd.OpenForm "MyDeptRosterMgmtPM", , , , , acHidden
DoCmd.RunCommand acCmdPrint
DoCmd.Close acForm, "MyDeptRosterMgmtAM", acSaveYes
DoCmd.Close acForm, "MyDeptRosterMgmtPM", acSaveYes


cDept = Null


DoCmd.SetWarnings True
Application.Echo True

The problem is that the program asks if the user wants to print over and over. I thought maybe the setwarnings would hide this, but that didn't work. Is there some other code that I can use that would choose "Yes" on the users' behalf? The image shows the prompt I'm trying to bypass.



Not sure if you'll be able to see it, it's the typical Windows Print box with the name of the printer, asking if you want to print all the pages, number of copies, then Ok or Cancel. I want to hit ok here on the users' behalf.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,221,692
Messages
6,161,351
Members
451,697
Latest member
pedroDH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top