Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello - I thought I posted this question earlier today, but now I
cannot find it. My problem concerns formatting a page to print. The page has multiple columns, and it is not possible to know how wide the columns will be in advance - that is to say, each time the program is used, the column widths are set automatically to agree with the width of the data. Then the result is printed. If there are more than a pre-defined number of columns, the macro does a special format for page two, and the printing appears on two pages for clarity I would like to use the entire sheet of paper on each page so the print is as large as practical. I wrote a macro to reformat the pages for 2 sheets under certain conditions, and it works fine. However, I cannot figure out how to use the 'fit to page' option. I would like to have it in the macro so that the printout will expand as much as practical to fill each of the two pages. However, whenever I add the 'fit to page' statement to the program, the page break disappears and does not function, 'even if I am specifying print to 2 pages.' Here is part of the code; ActiveSheet.PageSetup.PrintArea = "$D$2:$CC$246" With ActiveSheet.PageSetup .Zoom = False .FitToPagesWide = 2 .FitToPagesTall = 1 Forgive me if I have double posted, but I do need some help. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you tell Excel to fit to 2 pages wide, Excel will decide where to break
the pages. A possible workaround would be to set the print area for the first page, print it using fit to page, then set the print area for the second page and print it using fit to page. If this doesn't cause trouble with your page numbering in the header/footer, then it might be workable. Even if it does, you can also set the page number in your macro. James wrote in message ups.com... Hello - I thought I posted this question earlier today, but now I cannot find it. My problem concerns formatting a page to print. The page has multiple columns, and it is not possible to know how wide the columns will be in advance - that is to say, each time the program is used, the column widths are set automatically to agree with the width of the data. Then the result is printed. If there are more than a pre-defined number of columns, the macro does a special format for page two, and the printing appears on two pages for clarity I would like to use the entire sheet of paper on each page so the print is as large as practical. I wrote a macro to reformat the pages for 2 sheets under certain conditions, and it works fine. However, I cannot figure out how to use the 'fit to page' option. I would like to have it in the macro so that the printout will expand as much as practical to fill each of the two pages. However, whenever I add the 'fit to page' statement to the program, the page break disappears and does not function, 'even if I am specifying print to 2 pages.' Here is part of the code; ActiveSheet.PageSetup.PrintArea = "$D$2:$CC$246" With ActiveSheet.PageSetup .Zoom = False .FitToPagesWide = 2 .FitToPagesTall = 1 Forgive me if I have double posted, but I do need some help. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Aug 31, 8:43 am, "Zone" wrote:
If you tell Excel to fit to 2 pages wide, Excel will decide where to break the pages. A possible workaround would be to set the print area for the first page, print it using fit to page, then set the print area for the second page and print it using fit to page. If this doesn't cause trouble with your page numbering in the header/footer, then it might be workable. Even if it does, you can also set the page number in your macro. James wrote in message ups.com... Hello - I thought I posted this question earlier today, but now I cannot find it. My problem concerns formatting a page to print. The page has multiple columns, and it is not possible to know how wide the columns will be in advance - that is to say, each time the program is used, the column widths are set automatically to agree with the width of the data. Then the result is printed. If there are more than a pre-defined number of columns, the macro does a special format for page two, and the printing appears on two pages for clarity I would like to use the entire sheet of paper on each page so the print is as large as practical. I wrote a macro to reformat the pages for 2 sheets under certain conditions, and it works fine. However, I cannot figure out how to use the 'fit to page' option. I would like to have it in the macro so that the printout will expand as much as practical to fill each of the two pages. However, whenever I add the 'fit to page' statement to the program, the page break disappears and does not function, 'even if I am specifying print to 2 pages.' Here is part of the code; ActiveSheet.PageSetup.PrintArea = "$D$2:$CC$246" With ActiveSheet.PageSetup .Zoom = False .FitToPagesWide = 2 .FitToPagesTall = 1 Forgive me if I have double posted, but I do need some help.- Hide quoted text - - Show quoted text - Thanks for responding. My concern is that the users of the program will not be very computer literate (even worse than me...) and will probably go to the 'Print' command rather than knowing to trigger a macro. Perhaps I have to do it by brute force, pre-calculating the options and pre-setting the pages in their many configurations. That I can do - but I was looking for a more elegant and less memory intensive approach if there is one... |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can have your print setup occur automatically whenever a user prints.
Copy the code below. With the spreadsheet on the screen, right-click on the Excel icon on the very left of the menubar and select View Code. Paste the code in there. Adjust the print ranges as ActiveSheet.Name as needed. HTH, James Private Sub Workbook_BeforePrint(Cancel As Boolean) If ActiveSheet.Name = "Sheet1" Then With ActiveSheet.PageSetup 'set and print first page .PrintArea = "a1:k20" .RightFooter = "Page 1" .Zoom = False .FitToPagesWide = 2 .FitToPagesTall = 1 ActiveSheet.PrintOut 'set and print second page .PrintArea = "L1:s20" .RightFooter = "Page 2" .Zoom = False .FitToPagesWide = 2 .FitToPagesTall = 1 ActiveSheet.PrintOut End With End If End Sub wrote in message oups.com... On Aug 31, 8:43 am, "Zone" wrote: If you tell Excel to fit to 2 pages wide, Excel will decide where to break the pages. A possible workaround would be to set the print area for the first page, print it using fit to page, then set the print area for the second page and print it using fit to page. If this doesn't cause trouble with your page numbering in the header/footer, then it might be workable. Even if it does, you can also set the page number in your macro. James wrote in message ups.com... Hello - I thought I posted this question earlier today, but now I cannot find it. My problem concerns formatting a page to print. The page has multiple columns, and it is not possible to know how wide the columns will be in advance - that is to say, each time the program is used, the column widths are set automatically to agree with the width of the data. Then the result is printed. If there are more than a pre-defined number of columns, the macro does a special format for page two, and the printing appears on two pages for clarity I would like to use the entire sheet of paper on each page so the print is as large as practical. I wrote a macro to reformat the pages for 2 sheets under certain conditions, and it works fine. However, I cannot figure out how to use the 'fit to page' option. I would like to have it in the macro so that the printout will expand as much as practical to fill each of the two pages. However, whenever I add the 'fit to page' statement to the program, the page break disappears and does not function, 'even if I am specifying print to 2 pages.' Here is part of the code; ActiveSheet.PageSetup.PrintArea = "$D$2:$CC$246" With ActiveSheet.PageSetup .Zoom = False .FitToPagesWide = 2 .FitToPagesTall = 1 Forgive me if I have double posted, but I do need some help.- Hide quoted text - - Show quoted text - Thanks for responding. My concern is that the users of the program will not be very computer literate (even worse than me...) and will probably go to the 'Print' command rather than knowing to trigger a macro. Perhaps I have to do it by brute force, pre-calculating the options and pre-setting the pages in their many configurations. That I can do - but I was looking for a more elegant and less memory intensive approach if there is one... |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Oops, typo. Last sentence should read "adjust the print ranges and
ActiveSheet.Name as needed" "Zone" wrote in message ... You can have your print setup occur automatically whenever a user prints. Copy the code below. With the spreadsheet on the screen, right-click on the Excel icon on the very left of the menubar and select View Code. Paste the code in there. Adjust the print ranges as ActiveSheet.Name as needed. HTH, James Private Sub Workbook_BeforePrint(Cancel As Boolean) If ActiveSheet.Name = "Sheet1" Then With ActiveSheet.PageSetup 'set and print first page .PrintArea = "a1:k20" .RightFooter = "Page 1" .Zoom = False .FitToPagesWide = 2 .FitToPagesTall = 1 ActiveSheet.PrintOut 'set and print second page .PrintArea = "L1:s20" .RightFooter = "Page 2" .Zoom = False .FitToPagesWide = 2 .FitToPagesTall = 1 ActiveSheet.PrintOut End With End If End Sub wrote in message oups.com... On Aug 31, 8:43 am, "Zone" wrote: If you tell Excel to fit to 2 pages wide, Excel will decide where to break the pages. A possible workaround would be to set the print area for the first page, print it using fit to page, then set the print area for the second page and print it using fit to page. If this doesn't cause trouble with your page numbering in the header/footer, then it might be workable. Even if it does, you can also set the page number in your macro. James wrote in message ups.com... Hello - I thought I posted this question earlier today, but now I cannot find it. My problem concerns formatting a page to print. The page has multiple columns, and it is not possible to know how wide the columns will be in advance - that is to say, each time the program is used, the column widths are set automatically to agree with the width of the data. Then the result is printed. If there are more than a pre-defined number of columns, the macro does a special format for page two, and the printing appears on two pages for clarity I would like to use the entire sheet of paper on each page so the print is as large as practical. I wrote a macro to reformat the pages for 2 sheets under certain conditions, and it works fine. However, I cannot figure out how to use the 'fit to page' option. I would like to have it in the macro so that the printout will expand as much as practical to fill each of the two pages. However, whenever I add the 'fit to page' statement to the program, the page break disappears and does not function, 'even if I am specifying print to 2 pages.' Here is part of the code; ActiveSheet.PageSetup.PrintArea = "$D$2:$CC$246" With ActiveSheet.PageSetup .Zoom = False .FitToPagesWide = 2 .FitToPagesTall = 1 Forgive me if I have double posted, but I do need some help.- Hide quoted text - - Show quoted text - Thanks for responding. My concern is that the users of the program will not be very computer literate (even worse than me...) and will probably go to the 'Print' command rather than knowing to trigger a macro. Perhaps I have to do it by brute force, pre-calculating the options and pre-setting the pages in their many configurations. That I can do - but I was looking for a more elegant and less memory intensive approach if there is one... |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Aug 31, 11:58 am, "Zone" wrote:
Oops, typo. Last sentence should read "adjust the print ranges and ActiveSheet.Name as needed" "Zone" wrote in message ... You can have your print setup occur automatically whenever a user prints. Copy the code below. With the spreadsheet on the screen, right-click on the Excel icon on the very left of the menubar and select View Code. Paste the code in there. Adjust the print ranges as ActiveSheet.Name as needed. HTH, James Private Sub Workbook_BeforePrint(Cancel As Boolean) If ActiveSheet.Name = "Sheet1" Then With ActiveSheet.PageSetup 'set and print first page .PrintArea = "a1:k20" .RightFooter = "Page 1" .Zoom = False .FitToPagesWide = 2 .FitToPagesTall = 1 ActiveSheet.PrintOut 'set and print second page .PrintArea = "L1:s20" .RightFooter = "Page 2" .Zoom = False .FitToPagesWide = 2 .FitToPagesTall = 1 ActiveSheet.PrintOut End With End If End Sub wrote in message roups.com... On Aug 31, 8:43 am, "Zone" wrote: If you tell Excel to fit to 2 pages wide, Excel will decide where to break the pages. A possible workaround would be to set the print area for the first page, print it using fit to page, then set the print area for the second page and print it using fit to page. If this doesn't cause trouble with your page numbering in the header/footer, then it might be workable. Even if it does, you can also set the page number in your macro. James wrote in message groups.com... Hello - I thought I posted this question earlier today, but now I cannot find it. My problem concerns formatting a page to print. The page has multiple columns, and it is not possible to know how wide the columns will be in advance - that is to say, each time the program is used, the column widths are set automatically to agree with the width of the data. Then the result is printed. If there are more than a pre-defined number of columns, the macro does a special format for page two, and the printing appears on two pages for clarity I would like to use the entire sheet of paper on each page so the print is as large as practical. I wrote a macro to reformat the pages for 2 sheets under certain conditions, and it works fine. However, I cannot figure out how to use the 'fit to page' option. I would like to have it in the macro so that the printout will expand as much as practical to fill each of the two pages. However, whenever I add the 'fit to page' statement to the program, the page break disappears and does not function, 'even if I am specifying print to 2 pages.' Here is part of the code; ActiveSheet.PageSetup.PrintArea = "$D$2:$CC$246" With ActiveSheet.PageSetup .Zoom = False .FitToPagesWide = 2 .FitToPagesTall = 1 Forgive me if I have double posted, but I do need some help.- Hide quoted text - - Show quoted text - Thanks for responding. My concern is that the users of the program will not be very computer literate (even worse than me...) and will probably go to the 'Print' command rather than knowing to trigger a macro. Perhaps I have to do it by brute force, pre-calculating the options and pre-setting the pages in their many configurations. That I can do - but I was looking for a more elegant and less memory intensive approach if there is one...- Hide quoted text - - Show quoted text - I cannot seem to get this to work properly. I put the code in the Workbook module. I could not get it to function - multiple copies of the pages were printing, so I changed the code to say "fit to pages wide - 1" and it now prints only one copy of the first page, but 2 of the second page. Plus I tried to introduce a variable so I could define when I wanted to put all the data on a single page, but I couild not get that to work in this arena other. Any way I can fix this?? |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm sorry you're having a problem with it. It seems to work fine for me, so
I can't recreate the problem. James I cannot seem to get this to work properly. I put the code in the Workbook module. I could not get it to function - multiple copies of the pages were printing, so I changed the code to say "fit to pages wide - 1" and it now prints only one copy of the first page, but 2 of the second page. Plus I tried to introduce a variable so I could define when I wanted to put all the data on a single page, but I couild not get that to work in this arena other. Any way I can fix this?? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Print Problem | Excel Discussion (Misc queries) | |||
Print problem | Excel Programming | |||
Print problem | Excel Programming | |||
Print problem | Excel Programming | |||
Print problem | Excel Programming |