Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Problem with code to print - out of order

Hi everyone. I have some code that references column D, which has the full
path of a file, and column A which has a checkbox. The code
opens every file (one at a time) that is listed in column D with a check in
A, updates links, prints the sheets listed in columns E through BB, and then
finally closes the file. It then loops through all files listed.

I noticed that when this runs, the sheets come in in a somewhat jumbled
order. Is it possible that the code is processing too quickly, and when the
jobs get spooled to the printer they sometimes jump out of order? Would a
pause between print commands help? I really need the files and sheets to
come out in the exact order that they are listed in the worksheet. Thanks
for your help!



Sub PrintFiles()

Dim rng As Range, rng1 As Range
Dim cell As Range, cell1 As Range
Dim bk As Workbook
Dim WbOpen As String
Dim mysheet As Worksheet

Application.DisplayAlerts = False
Application.ScreenUpdating = False


Set rng = Range("D7:D" & Range("D65536").End(xlUp).Row)
For Each cell In rng
If Trim(cell.Value) < "" Then
If Cells(cell.Row, 1).Value = True Then
WbOpen = cell.Value
Workbooks.Open (WbOpen), UpdateLinks:=1
Set bk = ActiveWorkbook

ThisWorkbook.Activate
Set rng1 = cell.Offset(0, 1).Resize(1,
50).SpecialCells(xlConstants)
For Each cell1 In rng1
If LCase(cell1.Value) = "all" Then
bk.PrintOut
'Cells(cell.Row, 4).Interior.ColorIndex = 35
Exit For
Else
If Trim(cell1.Value) < "" Then
bk.Worksheets(cell1.Value).PrintOut
End If
End If
Next

WbOpen = ""
bk.Close SaveChanges:=True
Set bk = Nothing
End If
End If
Next
Application.ScreenUpdating = True
Application.DisplayAlerts = False

End Sub


Reply
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
Changing Print Order woody22 Excel Discussion (Misc queries) 2 April 1st 14 03:13 PM
Selection order problem with code for shapes connection [email protected] Excel Programming 2 August 12th 05 02:03 PM
VBA Code to Print a Variable as part of CenterHeader Problem gvlral Excel Programming 2 January 30th 05 06:27 PM
Tab Order Code Problem Ryan Excel Programming 3 April 19th 04 05:01 PM
Continuing print code problem Stuart[_5_] Excel Programming 0 August 5th 03 06:54 PM


All times are GMT +1. The time now is 05:38 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"