Controlling Print Defaults - Printing From Windows Explorer

K

Kim

I have several Excel workbooks that need to be printed (in order). I am
trying to print them from Windows Explorer by selecting all of my files and
printing from File + Print -- but -- because the default is to print only the
current sheet, the entire workbook will not print. Any suggestions? Thank
you.
 
B

Barb R.

When I select File -> Print ... I have an option to print the Entire
Workbook. I'm using Excel 2002.
 
D

Dave Peterson

How about a workbook that opens each workbook, then prints each entire workbook,
closes it and repeats.


Option Explicit
Sub auto_open()

Dim myFileNames As Variant
Dim wkbk As Workbook
Dim iCtr As Long
Dim testStr As String

myFileNames = Array("C:\my documents\excel\book1.xls", _
"c:\my documents\excel\test\book2.xls")

For iCtr = LBound(myFileNames) To UBound(myFileNames)
testStr = ""
On Error Resume Next
testStr = Dir(myFileNames(iCtr))
On Error GoTo 0

If testStr = "" Then
MsgBox myFileNames(iCtr) & " wasn't found!"
Else
Set wkbk = Workbooks.Open(Filename:=myFileNames(iCtr))
wkbk.PrintOut preview:=True
wkbk.Close savechanges:=False
End If
Next iCtr

'thisworkbook.Close savechanges:=false

End Sub

I used preview:=true to save some trees.

And when you're done testing, remove the comment from that last .close line.
Save the workbook with the code first--else you'll be recreating it.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
Top