Print preview form

Petepete11

New Member
Joined
Apr 13, 2016
Messages
9
Hi, I have established a 'Me-PrintForm' command button which prints my form, however it doesn't first request a preview of what it looks like before printing and it doesn't fit on the page when printed. Is there a way to have a preview of what it looks like first before printing immediately.
Many thanks,
Pete
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Not exactly sure what you are trying to achieve.

1. What do you want to happen if it doesn't fit correctly on the page? You did say "preview of what it looks like first before printing immediately" which seems to me to waste the print preview if it is going to print anyway. ??

2. If it normally fits on the page or only just misses, have you considered going in to Page Setup from the Page Layout ribbon tab and then on the 'Page' tab, use the 'Fit to:' option to ensure that it does always fit on the page?

Anyway, you might see if this is at all heading in the right direction. This code would go in the ThisWorkbook mode in the VBA window.

Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
  Dim Resp As VbMsgBoxResult
  
  Application.EnableEvents = False
  ActiveSheet.PrintPreview
  Resp = MsgBox("Do you want to print?", vbYesNo)
  If Resp <> vbYes Then Cancel = True
  Application.EnableEvents = True
End Sub
 
Upvote 0
Sorry I didn't explain it well.
I'm wanting to print just the UserForm, not the workbook/spreadsheet. Which the command button I've assigned works, however it prints the form straight away without asking for a print preview first.
 
Upvote 0
I'm wanting to print just the UserForm, not the workbook/spreadsheet.
My mistake. You did say form but many forum members use that term when referring to their worksheets. I don't have a solution for you, sorry.
 
Upvote 0

Forum statistics

Threads
1,216,816
Messages
6,132,868
Members
449,761
Latest member
AUSSW

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