Microsoft Office Tutorials and References
In Depth Information
Excel Procedures
Excel Procedures
By Juan Pablo González
Printing All Files
Use this procedure to print all the available workbooks within a directory
without having to open and print each one separately.
Example file:
Scenario: This macro is useful when there is a list of files
(for instance, sales reports from different regions or statistics
from all the departments in the company) within a folder
and/or its subfolders, and printing them out quickly is
View the Appendix to learn about storing this
procedure in a Standard module.
Option Explicit¶
' * * * * *¶
Sub PrintAllFiles()¶
'This macro will print all files in a specific directory¶
'Variable declarations¶
'Variable containing the name where Excel will search¶
Dim Folder As String¶
'Workbook for each document¶
Dim File As Workbook ¶
Dim Counter As Long¶
'Decides if Excel needs to look in subfolders¶
Dim LookInSubFolders As Boolean¶
'Store old calculation method¶
Dim OldCalculation As Long¶
'Change the following variables¶
'set the folder programatically¶
Folder = "C:\"¶
'set the folder via user input¶
Folder = Range("B1").Value¶
'set the subfolder search programatically¶
LookInSubFolders = False¶
'set the subfolder search via user input¶
LookInSubFolders = Range("B2").Value¶
'Turn off various settings to speed up the code¶
Search JabSto ::

Custom Search