Print userform

joacro

Board Regular
Joined
Jun 24, 2010
Messages
158
Hi there,

I have a userform with a printbutton.

The aim is to bring up the print dialog so the user can select the printer and the amount of copies, print preview etc.

Hope someone can help me with this
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Try like this

Code:
Private Sub CommandButton1_Click()
Application.Dialogs(xlDialogPrinterSetup).Show
Me.PrintForm
End Sub
 
Upvote 0
Hi there,

Thank you it brings up the print dialog, but when the user want to cancel the print, the printing actually continue

Can you perhaps assist in this?
 
Upvote 0
Try

Code:
Private Sub CommandButton1_Click()
Dim RetStat
RetStat = Application.Dialogs(xlDialogPrinterSetup).Show
If RetStat Then Me.PrintForm
End Sub
 
Upvote 0
hi Peter, could you teach me how to save as PDF a form in vba? I used your guide that allow me to select another printer like a PDF Printer, but I know that the EXCEL has the propierty to do this, but I don't know how
 
Upvote 0
Sweet! Thanks!
This code also works with an ActiveX command button on a worksheet, BTW.
All you have to do is change "Me.PrintForm" to "Me.PrintOut"
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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