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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

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