printing userform landscape and on a4

SQUIDD

Well-known Member
Joined
Jan 2, 2009
Messages
1,667
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
 

Some videos you may like

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
3,237
.
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
 

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
3,237
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
 

Watch MrExcel Video

Forum statistics

Threads
1,099,333
Messages
5,467,992
Members
406,562
Latest member
Isbenji

This Week's Hot Topics

Top