Print layout

C

capt

I have the following code to print UserForm1.

Private Sub CommandButton3_Click()
UserForm1.PrintForm
End Sub

How do I get it to print in landscape?

Thank you
 
F

FloMM2

capt,
Try this:
Private Sub CommandButton3_Click()
Worksheets("UserForm1").Activate
ActiveSheet.PageSetup.Orientation = xlLandscape
ActiveSheet.PrintOut

End Sub
In this example, "UserForm1" would change to the sheet name(ie Sheet1).
hth
:)
 
C

capt

Thanks for that,
But its not working.
On sheet1 I have a command button that brings up my userform and its this
userform I wish to print. I can get it to print but only on portrate The
problem is that it does not fit the page.
 
C

capt

Thanks dave,
It works, but can you explain again how i change the layout to landscape?
 
D

Dave Peterson

That code plops down a picture of the userform onto a new sheet.

If you record a macro when you change the page setup to landscape, you'll see
that the code looks something like:

ActiveSheet.PageSetup.Orientation = xlLandscape


Thanks dave,
It works, but can you explain again how i change the layout to landscape?
 
C

capt

Thanks Dave,
It works well. All I need to do is to reduce the size of the print, its
printing on two pages on landscape.
I shall try running a macro and extracting the code.......hopefully!!!
 
C

capt

Sorry dave,
I am trying to reduce the size of the printing to fit on a A4 size paper,
cant manage it.
Iv tried running a macro and pasting the code over, but no joy.
Could you help
--
capt


capt said:
Thanks Dave,
It works well. All I need to do is to reduce the size of the print, its
printing on two pages on landscape.
I shall try running a macro and extracting the code.......hopefully!!!
 
C

capt

Actually Dave, I have sorted it out with the following code:

ActiveSheet.PageSetup.zoom = 85

Thanks again
 
D

Dave Peterson

Glad you got it working.

Recording a macro when you do the page setup gives you lots of things that you
may not need to change. In your modified code, just keep the lines of code that
are associated with what you want changed (.zoom and .orientation).

If you delete (or comment that code) that you don't need, you may notice that
your macro takes less time to execute.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top