View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Using macro to change printrange / fit-to-page

Hi Marco

Try this

With ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
ActiveSheet.PrintOut


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Marco" wrote in message ...
Hello all,

I have a macro to create an invoice. At the end the worksheet is copied to a new worksheet and automatically saved. But when I

want to print this new worksheet it doesn't fit on 1 page. When I use the fit-to-page option in the print-options box it's working.
But I want to do this in the macro. So after I copied the sheet, I would like to give a command to set fit-to-page.

This is the syntax I use to copy:
Sheets("Invoice").Select
Window1$ = ActiveWindow.Caption
Range("A1:M50").Select
Selection.Copy
Workbooks.Add
Window2$ = ActiveWindow.Caption
ActiveSheet.DropDowns.Add(144, 105.75, 248, 15.75).Select
ActiveSheet.Paste
Windows(Window1$).Activate
Range("B2").Select
Application.CutCopyMode = False
Windows(Window2$).Activate

Anyone an idea how I can do this?

Thanks in advance for any help.

Marco.