LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserted Shape Prints in Different Location on Sheet Dave Excel Discussion (Misc queries) 0 April 22nd 08 01:00 AM
Excel 2007 spread sheet prints slow. MarcyS Excel Discussion (Misc queries) 1 August 22nd 07 12:40 AM
Only part of my excel sheet prints to a pdf dennis Excel Discussion (Misc queries) 0 August 11th 06 10:41 PM
Excel Sheet Only Prints a Line Parker Excel Discussion (Misc queries) 7 September 12th 05 08:41 PM
How to +1 to a cell everytime the sheet prints? Geoff A Excel Programming 3 September 18th 03 06:01 PM


All times are GMT +1. The time now is 02:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"