printing userform landscape and on a4

SQUIDD

Well-known Member
Joined
Jan 2, 2009
Messages
2,126
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hello all

I want to print my userform on a4 in landscape.

i have searched the web for answers, have found code also, but it just does not work for me.

i cant really pull the data from the userform to a sheet either, well not easily, i have certian layout and tickboxes etc

the code i have found, other users have mentioned it has work for them also, but i get errors.

can anyone help or point me in the right direction.

id be happy with a button that screenshot it and printed?

thanks

dave
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
.
This prints PORTRAIT. See if you can edit the code for LANDSCAPE :

Code:
Option Explicit


Private Sub CommandButton1_Click()
    Dim h1 As Worksheet
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    Set h1 = Sheets.Add
    Application.SendKeys "(%{1068})"
    DoEvents
    h1.Paste
    h1.ExportAsFixedFormat Type:=xlTypePDF, Filename:=ThisWorkbook.Path & "\" & "userform.pdf"
    h1.Delete
End Sub
 
Upvote 0
This works here:

Code:
Option Explicit


Private Sub CommandButton1_Click()
    Dim h1 As Worksheet
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    Set h1 = Sheets.Add
    h1.PageSetup.Orientation = xlLandscape
    Application.SendKeys "(%{1068})"
    DoEvents
    h1.Paste
    h1.ExportAsFixedFormat Type:=xlTypePDF, Filename:=ThisWorkbook.Path & "\" & "userform.pdf"
    h1.Delete
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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