View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
TotallyConfused TotallyConfused is offline
external usenet poster
 
Posts: 144
Default How to set PrintSetup?

Thank you this works just fine. However, different users will be using this
form and will want to print the form. I would like to make it as easy as
possible. Right now the way the form comes up is very small for anyone to
read. I would like to the to print three pages in one portrait size sheet.
I am having trouble setting up the margins to be 0.25 for top, bottom, left
and right. Which would print to five pages. I tried several way to do this
and I am not being very successful.

When I exit the userform is fine and then it will ask me if I want to save
or not or cancel the Sheet1. If I have it I have not problems. If I click
on "No" I get the following run time error message of 438, "Object does not
support this property or method". When I click on debug it takes me to the
following code and the RequestorInfo line is highlighted in yellow:

Can you please help me with this? Thank you.

Private Sub CommandButton3_Click()

If MsgBox("Do you want to Exit?", vbOKCancel, "Exit or Cancel??") = vbOK Then
'whatever you want to do
Unload Me 'closes the form
ActiveWorkbook.Close 'closes the workbook
RequestorInfo(RequestorInfo).Visible = False
End If

End Sub




"TotallyConfused" wrote:

I need help please. How do I send a Userfrom to print all 5 pages of my form
to print in landscape and the form to fit on a 8.5 x 11 sheet of paper.
After a lot of research I have the following code. It prints my form but
only the page I am when I hit the print button. I want all pages to print.
And how can you force it to print the form in one page. Right now it prints
the screen on 4 pages with parts of the form on all pages. I would
appreciate very much any help you can provide. Thank you.



Private Sub CommandButton6_Click()

UserForm2.PrintForm
ActiveSheet.PageSetup.Orientation = xlLandscape
' keybd_event VK_SNAPSHOT, 0, 0, 0
DoEvents
keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY, 0
keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY, 0
keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY + _
KEYEVENTF_KEYUP, 0
keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY + _
KEYEVENTF_KEYUP, 0
DoEvents
Workbooks.Add
Application.Wait Now + TimeValue("00:00:01")
ActiveSheet.PasteSpecial Format:="Bitmap", Link:=False, _
DisplayAsIcon:=False
ActiveSheet.Range("A1").Select
'added to force landscape
ActiveSheet.PageSetup.Orientation = xlLandscape
ActiveSheet.PageSetup.FitToPagesWide = 1
ActiveSheet.PageSetup.FitToPagesTall = 1
ActiveWindow.SelectedSheets.PrintOut Copies:=1

ActiveWorkbook.Close False
End Sub