Print A Sheet

You can create a procedure to print the contents of a sheet using the PrintOut method. Not only do you have the ability to specify what to print, you can also specify the number of copies to print or the method to print the contents of a sheet to a file. The PrintOut method has several different properties available for specifying how Excel prints the sheet: From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, and PrToFileName.

You use the From and To parameters to indicate the range of pages within the specified sheet to print. You indicate the page number of the first page to print as the value of the From parameter and the page number of the last page as the value of the To parameter. If you omit these parameters, Excel prints the entire sheet.

By default, Excel prints one copy of the sheet. For multiple copies, use the Copies parameter to indicate the desired number. You can specify a value of True for the Collate parameter to have Excel collate the copies.

If you want the Excel preview window to show the contents of the print selection, set the value of the Preview parameter to True. Keep in mind that the Print button on the Print Preview screen actually prints the copy and that the Close button cancels the print.

You can specify the printer Excel uses with the ActivePrinter parameter. To set a default printer, you can specify the name of the printer for this parameter.

You can also send the printout to a file instead of a printer by setting the PrintToFile parameter to True and specifying the name of the file to which you want to send the printout. If you do not specify a filename, Excel prompts you for one when your procedure runs.

PRINT A SHEET

PRINT A SHEET

LQ Create a new subroutine.

Type ActiveSheet. PageSetup.PrintArea =

"$A$2:$H$9", replacing "$A$2:$H$9" with the range of cells to print.

LQ Create a new subroutine.

Type ActiveSheet. PageSetup.PrintArea =

"$A$2:$H$9", replacing "$A$2:$H$9" with the range of cells to print.

0 0

Post a comment