ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Controlling Print Defaults - Printing From Windows Explorer (https://www.excelbanter.com/excel-discussion-misc-queries/28944-controlling-print-defaults-printing-windows-explorer.html)

Kim

Controlling Print Defaults - Printing From Windows Explorer
 
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.

Barb R.

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

"Kim" wrote:

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.


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

Kim wrote:

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.


--

Dave Peterson


All times are GMT +1. The time now is 11:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com