Microsoft KB Archive/89753

{|
 * width="100%"|

XL: How to Print all Documents in a Workbook

 * }

-

The information in this article applies to:


 * Microsoft Excel for Windows, version 4.0
 * Microsoft Excel for the Macintosh, version 4.0

-

SUMMARY
In version 4.0 of Microsoft Excel, you can print all bound and unbound documents in a workbook in Group Edit mode or with a macro.

Note that this a built-in feature in Microsoft Excel version 5.0.

MORE INFORMATION
Workbooks in Microsoft Excel provide a convenient way to organize documents. The following information covers a couple of methods for printing all the documents in a workbook.

Printing Workbook Documents in Group Edit Mode
NOTE: Using this method you can specify which documents you want printed and even include documents that are not contained in your workbook.

To print workbook documents in Group Edit mode, follow these steps:


 * 1) Open your workbook and any additional documents you want to print.
 * 2) From the Options menu, choose Group Edit.

NOTE: Switching to another document window while in Group Edit mode will end the group edit session.
 * 1) In the Group Edit dialog box, select the documents you want to print from the Select Group list.

You can select multiple documents by holding down the CONTROL key (COMMAND on the Macintosh) while you click the document name. To cancel the selection of a document, hold down CONTROL (COMMAND on the Macintosh) and click the selected document name.

To select a group of contiguous names in the list, select the first name, then hold down the SHIFT key and select the last name you want. All the names between these two in the list will be selected.
 * 1) Choose the OK button to return to Microsoft Excel in Group Edit mode.
 * 2) From the File menu, choose Print.

Microsoft Excel prints all the documents you have selected as your edit group. To exit Group Edit mode, switch to any document window other than the active window.

Printing Workbook Documents with a Macro
The following macro is an example of one way to automate the printing of all documents in a workbook.

To print all documents in a workbook with this macro, you must first open the Workbook Contents window and then run the macro.

  A1: PrintDocs                        B1: Comments A2: =GET.DOCUMENT(1)                B2: Get workbook name A3: =ERROR(FALSE)                   B3: A4: =ACTIVATE.NEXT(A2)              B4: Get first document A5: =WHILE(NOT(GET.DOCUMENT(1)=A2)) B5: Repeat until Contents window A6: = PRINT                       B6: Print the document A7: = ACTIVATE.NEXT(A2)             B7: Activate next document A8: =NEXT A9: =RETURN