ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Userform Print (https://www.excelbanter.com/excel-programming/300606-userform-print.html)

richard

Userform Print
 
When i insert a button to print the userform, it always
comes out in portrait A3. I assume this is from default
printer settings?

Can i set up the form to print out as i want it to (A4
landscape)?

Thanks in advance

Richard

mona001[_3_]

Userform Print
 
Hi

--
Message posted from http://www.ExcelForum.com


mona001[_4_]

Userform Print
 
Hi,

I´m with the same problem you are. Did you find any solution fo
this

--
Message posted from http://www.ExcelForum.com


Michel Pierron[_2_]

Userform Print
 
Hi Richard,
I believe that there is no direct solution but you can use this code:
Private Declare Function OpenClipboard& Lib "user32" (ByVal hwnd&)
Private Declare Function EmptyClipboard& Lib "user32" ()
Private Declare Function CloseClipboard& Lib "user32" ()
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte _
, ByVal bScan As Byte, ByVal dwFlags&, ByVal dwExtraInfo&)

Private Sub PrintButton_Click()
Me.Repaint
OpenClipboard 0&
EmptyClipboard
keybd_event &H2C, 0, 0&, 0&
CloseClipboard
DoEvents
Application.ScreenUpdating = False
Dim NewBook As String
Workbooks.Add: ActiveSheet.Paste
NewBook = ActiveWorkbook.Name
With ActiveSheet.PageSetup
.RightFooter = Me.Caption & " Le &D Page &P/&N"
.PrintGridlines = False
.Orientation = xlLandscape
.PaperSize = xlPaperA4
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
End With
ActiveWindow.Visible = False
Application.ScreenUpdating = True
Me.Hide
Windows(NewBook).SelectedSheets.PrintOut Copies:=1
Workbooks(NewBook).Close False
Me.Show
End Sub

Regards,
MP

"Richard" a écrit dans le message de
...
When i insert a button to print the userform, it always
comes out in portrait A3. I assume this is from default
printer settings?

Can i set up the form to print out as i want it to (A4
landscape)?

Thanks in advance

Richard





All times are GMT +1. The time now is 09:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com