Batch Printing of Files from Excel

ID: Q48144




The information in this article applies to:
  • Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 4.0a
  • Microsoft Excel for the Macintosh, versions 2.x, 3.0, 4.0


SUMMARY

The following macro prints a batch of files that are all found in the same directory. It requests a directory name and then prints all the files in that directory.


   A1: Batch Print
   A2: =INPUT("Input the Directory of the files to print",2,"Batch
        Print Directory")
   A3: =DIRECTORY(A2)
   A4: =COLUMNS(FILES("*.xl?"))
   A5: =FOR("count",1,A4,1)
   A6: =OPEN(INDEX(FILES("*.xl?"),count),FALSE,FALSE)
   A7: =PRINT()
   A8: =CLOSE()
   A9: =NEXT()
   A10: =RETURN() 
If you are using Microsoft Excel for the Macintosh, you need to change lines A4 and A6 as follows:

   A4: =Columns(files(":*")) 

   A6: =Open(Index(Files(":*"),count),false,false) 
If the directory contains more than 20 files and you are using versions of Microsoft Excel with Microsoft Windows 2.x or the run-time Microsoft Excel, the spooler should be disabled through the WIN.INI file by setting spooler=no. If you are using Microsoft Windows 3.0 or greater, remove the check in the Use Print Manager check box in the Printers dialog box in the Microsoft Windows 3.0 Control Panel.

Additional query words:

Keywords :
Version :
Platform :
Issue type :


Last Reviewed: July 29, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.