printer macro

somersault

Board Regular
Joined
Jun 24, 2008
Messages
59
Hi,

I got this code from one of your threads.
application.Dialogs(xlDialogPrinterSetup).Show

I am trying to use this code but don't know how to use the OK, Cancel & Set-up buttons selection after this.

Could anyone pls guide me?

Thanks in advance
 

Some videos you may like

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Something like this

Code:
Sub TestPrint()
Dim bResponse As Boolean
bResponse = Application.Dialogs(xlDialogPrinterSetup).Show
If bResponse = False Then
    MsgBox "User cancelled"
    Exit Sub
End If
ActiveSheet.PrintOut
End Sub
 

somersault

Board Regular
Joined
Jun 24, 2008
Messages
59
Something like this

Code:
Sub TestPrint()
Dim bResponse As Boolean
bResponse = Application.Dialogs(xlDialogPrinterSetup).Show
If bResponse = False Then
    MsgBox "User cancelled"
    Exit Sub
End If
ActiveSheet.PrintOut
End Sub


This is fantastic.. Thank you..
One more question : Do I need to put a VBA code for setting options changed while the printer dialog box is open? Will default excel save this for me? (Case: i wanted to compel users only to take back to back (2sided prints))
 

Watch MrExcel Video

Forum statistics

Threads
1,122,371
Messages
5,595,782
Members
414,020
Latest member
Meghdad

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
Top