Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Why my VBA Code Prints each sheet twice
Sub Printbooks() DirName = InputBox("Enter the directory to search including final :", "Print Books") Nextbook = Dir(DirName & "*.xls") Do While (Nextbook < "" Or Nextbook < "G:\M Documents\Report_printing_at_a_go\Printbooks.XLS") MsgBox Nextbook & " is being opened" Workbooks.Open DirName & Nextbook For Each sheet In Workbooks() On Error Resume Next If Worksheets("Report").Activate < "" Then ' Application.Dialogs(xlDialogPrinterSetup).Show If ActiveSheet.Name = "Report" Then ActiveSheet.PrintOu preview:=False, Copies:=1 'ActiveWorkbook.PrintOut ActiveSheet.Close End If Next sheet MsgBox Nextbook & " is being closed" ActiveWorkbook.Close Nextbook = Dir() Loop End Sub The above code intend to print every sheet named report from th workbooks in a particular directory. Why does it print them twice Could anyone help me? jr200 -- jr200 ----------------------------------------------------------------------- jr2002's Profile: http://www.excelforum.com/member.php...fo&userid=1544 View this thread: http://www.excelforum.com/showthread.php?threadid=27042 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Inserted Shape Prints in Different Location on Sheet | Excel Discussion (Misc queries) | |||
Excel 2007 spread sheet prints slow. | Excel Discussion (Misc queries) | |||
Only part of my excel sheet prints to a pdf | Excel Discussion (Misc queries) | |||
Excel Sheet Only Prints a Line | Excel Discussion (Misc queries) | |||
How to +1 to a cell everytime the sheet prints? | Excel Programming |