Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() The following code is under my Print Macro button and works OK excep that I have increased the size of the form that it prints out and now spill onto a second page by about 5 lines. What can I include into the below code to fit the printout onto page?? Want it to work like the 'File' - 'Page Setup' - 'Fit To' option. Sub Button4_Click() 'Print Forms YesNo = MsgBox("Your selected Form will now be printed.", vbYesNo vbCritical, " Print Form") Select Case YesNo Case vbYes If vbYes Then GoTo 20 Else GoTo 10 10 Case vbNo If vbNo Then GoTo 30 End Select 20 Application.ScreenUpdating = False If ActiveSheet.Name = "Moves Request Form" Then Else End If Sheet1.PageSetup.PrintArea = "B1:CW43" 'Sets the Print area ActiveSheet.PrintOut 'Prints the Print area Sheet1.PageSetup.PrintArea = "" 'Clears the Print area If ActiveSheet.Name = "Moves Request Form" Then Else End If Application.ScreenUpdating = True 30 End Su -- grahamma ----------------------------------------------------------------------- grahammal's Profile: http://www.excelforum.com/member.php...fo&userid=2033 View this thread: http://www.excelforum.com/showthread.php?threadid=53886 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Grahammal,
a bit strange using of select case, also I didn't understand the purpose of "If ActiveSheet.Name = "Moves Request Form" Then", so I deleted it and rearanged your code: Sub Button4_Click() dim yesno as variant 'Print Forms YesNo = MsgBox("Your selected Form will now be printed.", vbYesNo + vbCritical, " Print Form") Select Case YesNo Case vbYes Application.ScreenUpdating = False with Sheet1.PageSetup ..PrintArea = "B1:CW43" 'Sets the Print area ..FitToPagesWide = 1 ..FitToPagesTall = 1 ActiveSheet.PrintOut 'Prints the Print area ..PrintArea = "" 'Clears the Print area end with Application.ScreenUpdating = true Case else exit sub End Select End Sub Regards, Ivan |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Have just tried the above but it still overflows to page 2 by the same amount? -- grahammal ------------------------------------------------------------------------ grahammal's Profile: http://www.excelforum.com/member.php...o&userid=20336 View this thread: http://www.excelforum.com/showthread...hreadid=538868 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() with Sheet1.PageSetup .PrintArea = "B1:CW43" 'Sets the Print area .FitToPagesWide = 1 .FitToPagesTall = 1 .Zoom = False sheet1.PrintOut 'Prints the Print area .PrintArea = "" 'Clears the end with -- Regards, Tom Ogilvy "grahammal" wrote: Have just tried the above but it still overflows to page 2 by the same amount? -- grahammal ------------------------------------------------------------------------ grahammal's Profile: http://www.excelforum.com/member.php...o&userid=20336 View this thread: http://www.excelforum.com/showthread...hreadid=538868 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Have now got it to work just fine. Than -- grahamma ----------------------------------------------------------------------- grahammal's Profile: http://www.excelforum.com/member.php...fo&userid=2033 View this thread: http://www.excelforum.com/showthread.php?threadid=53886 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pivot Table macro to set print area and print details of drill down data | Excel Discussion (Misc queries) | |||
Macro to open print window and set to print entire workbook | Excel Discussion (Misc queries) | |||
Create a print macro that would automatically select print area? | Excel Worksheet Functions | |||
Why does macro speed slow after Excel Print or Print Preview? | Excel Programming | |||
Need Help w/ Print Macro to Print All Visible Sheets (including Charts) in a Workbook | Excel Programming |