How to disable “Printing x of y” dialog when using the printer object

I have a new process that prints several hundred documents via a batch, but I don’t want the dialog to pop up every time it starts a new file.  This is really annoying as I might be typing in another window and the “Printing” dialog pops up as I’m hitting the spacebar and it thinks I want to cancel printing the document.

You can get around this by making a dummy print controller.

‘This was already declared earlier in the process
MyDocument = New PrintDocument()
Dim dlgPrintingDialog As New StandardPrintController
MyDocument.PrintController = dlbPrintingDialog

That’s it – now you can print and you won’t see a pop-up.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s