#1   Report Post  
Peter
 
Posts: n/a
Default Printing Problems...

Hello All..

I am trying to get my worksheets to play nicely..but no success.

I have say 10 worksheets, and in cell "B4" I have Client Copy (across all
sheets), so it needs to print all those sheets...
Then I need to change "B4" to Delivery Copy, then print all those sheets,
etc etc

Problem is at the moment, it goes through all the sheets, and only prints
the Dock Copy sheets (the last set). I see the text at "B4" change to what it
should, but just keeps going and ignoring the print call.

Sub delivery_copy()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
With sh
Range("E4").Select
ActiveCell = "Delivery Copy"
End With
Next sh
Worksheets.PrintOut

End Sub

I am using this in four seperate modules, each called from Sub
Workbook_BeforePrint.
As always, any advice is welcomed.

Regards
Peter

  #2   Report Post  
Ron de Bruin
 
Posts: n/a
Default

Hi Peter

You missed a dot before .Range(............

Sub delivery_copy()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
With sh
.Range("E4").Value = "Delivery Copy"
End With
Next sh
Worksheets.PrintOut
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Peter" wrote in message ...
Hello All..

I am trying to get my worksheets to play nicely..but no success.

I have say 10 worksheets, and in cell "B4" I have Client Copy (across all
sheets), so it needs to print all those sheets...
Then I need to change "B4" to Delivery Copy, then print all those sheets,
etc etc

Problem is at the moment, it goes through all the sheets, and only prints
the Dock Copy sheets (the last set). I see the text at "B4" change to what it
should, but just keeps going and ignoring the print call.

Sub delivery_copy()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
With sh
Range("E4").Select
ActiveCell = "Delivery Copy"
End With
Next sh
Worksheets.PrintOut

End Sub

I am using this in four seperate modules, each called from Sub
Workbook_BeforePrint.
As always, any advice is welcomed.

Regards
Peter



  #3   Report Post  
Peter
 
Posts: n/a
Default

Hi Ron,
Thanks for the dot =)
Unfortunatly it's still not printing the sheets the way they should be.

It dosn't seem to stop after it enters the new text into "B4" and print what
is on the sheets.
It should do this:
<=====call sub client_copy
Change B4 to Client Copy on all sheets.
Print all sheets
<=====call sub admin_copy
Change B4 to Admin Copy on all sheets
Print all sheets
<=====call sub delivery_copy
Change B4 to Delivery Copy on all sheets
Print all sheets
<=====call sub dock_copy
Change B4 to Dock Copy on all sheets
Print all sheets

Instead it gives the correct amount of pages, just all with Dock Copy on them.

Any idea's what I may have missed?

Regards
Peter


"Ron de Bruin" wrote:

Hi Peter

You missed a dot before .Range(............

Sub delivery_copy()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
With sh
.Range("E4").Value = "Delivery Copy"
End With
Next sh
Worksheets.PrintOut
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Peter" wrote in message ...
Hello All..

I am trying to get my worksheets to play nicely..but no success.

I have say 10 worksheets, and in cell "B4" I have Client Copy (across all
sheets), so it needs to print all those sheets...
Then I need to change "B4" to Delivery Copy, then print all those sheets,
etc etc

Problem is at the moment, it goes through all the sheets, and only prints
the Dock Copy sheets (the last set). I see the text at "B4" change to what it
should, but just keeps going and ignoring the print call.

Sub delivery_copy()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
With sh
Range("E4").Select
ActiveCell = "Delivery Copy"
End With
Next sh
Worksheets.PrintOut

End Sub

I am using this in four seperate modules, each called from Sub
Workbook_BeforePrint.
As always, any advice is welcomed.

Regards
Peter




  #4   Report Post  
Ron de Bruin
 
Posts: n/a
Default

Try this (all in one sub)

Sub Printtest()
Dim sh As Worksheet
Dim Astr
Dim N As Long

Astr = Array("Delivery Copy", "Client Copy", "Admin Copy", "dock_copy")
For N = LBound(Astr) To UBound(Astr)

For Each sh In ThisWorkbook.Worksheets
With sh
.Range("E4").Value = Astr(N)
End With
Next sh
Worksheets.PrintOut
Next N
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Peter" wrote in message ...
Hi Ron,
Thanks for the dot =)
Unfortunatly it's still not printing the sheets the way they should be.

It dosn't seem to stop after it enters the new text into "B4" and print what
is on the sheets.
It should do this:
<=====call sub client_copy
Change B4 to Client Copy on all sheets.
Print all sheets
<=====call sub admin_copy
Change B4 to Admin Copy on all sheets
Print all sheets
<=====call sub delivery_copy
Change B4 to Delivery Copy on all sheets
Print all sheets
<=====call sub dock_copy
Change B4 to Dock Copy on all sheets
Print all sheets

Instead it gives the correct amount of pages, just all with Dock Copy on them.

Any idea's what I may have missed?

Regards
Peter


"Ron de Bruin" wrote:

Hi Peter

You missed a dot before .Range(............

Sub delivery_copy()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
With sh
.Range("E4").Value = "Delivery Copy"
End With
Next sh
Worksheets.PrintOut
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Peter" wrote in message ...
Hello All..

I am trying to get my worksheets to play nicely..but no success.

I have say 10 worksheets, and in cell "B4" I have Client Copy (across all
sheets), so it needs to print all those sheets...
Then I need to change "B4" to Delivery Copy, then print all those sheets,
etc etc

Problem is at the moment, it goes through all the sheets, and only prints
the Dock Copy sheets (the last set). I see the text at "B4" change to what it
should, but just keeps going and ignoring the print call.

Sub delivery_copy()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
With sh
Range("E4").Select
ActiveCell = "Delivery Copy"
End With
Next sh
Worksheets.PrintOut

End Sub

I am using this in four seperate modules, each called from Sub
Workbook_BeforePrint.
As always, any advice is welcomed.

Regards
Peter






  #5   Report Post  
Ken Wright
 
Posts: n/a
Default

How about a single routine that does all 4 prints. Not tested, but

Sub delivery_copy()

Dim sh As Worksheet
Dim myval As String

For x = 1 To 4
Select Case x
Case 1: myval = "Client Copy"
Case 2: myval = "Delivery Copy"
Case 3: myval = "Filing Copy"
Case 4: myval = "Dock Copy"
End Select

For Each sh In ThisWorkbook.Worksheets
sh.Range("E4").Value = myval
Next sh
Worksheets.PrintOut
Next x

End Sub

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"Peter" wrote in message
...
Hello All..

I am trying to get my worksheets to play nicely..but no success.

I have say 10 worksheets, and in cell "B4" I have Client Copy (across all
sheets), so it needs to print all those sheets...
Then I need to change "B4" to Delivery Copy, then print all those sheets,
etc etc

Problem is at the moment, it goes through all the sheets, and only prints
the Dock Copy sheets (the last set). I see the text at "B4" change to what

it
should, but just keeps going and ignoring the print call.

Sub delivery_copy()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
With sh
Range("E4").Select
ActiveCell = "Delivery Copy"
End With
Next sh
Worksheets.PrintOut

End Sub

I am using this in four seperate modules, each called from Sub
Workbook_BeforePrint.
As always, any advice is welcomed.

Regards
Peter





  #6   Report Post  
Peter
 
Posts: n/a
Default

Thanks Again Ron,
Still doing exactly the same thing though.

It cycles through all the page names on each page then prints only the last
one.

The page about to be printed pop's up on screen, then the B4 range changes
really fast from Client Copy through to Dock Copy, then prints the Dock Copy.

Regards
Peter

"Ron de Bruin" wrote:

Try this (all in one sub)

Sub Printtest()
Dim sh As Worksheet
Dim Astr
Dim N As Long

Astr = Array("Delivery Copy", "Client Copy", "Admin Copy", "dock_copy")
For N = LBound(Astr) To UBound(Astr)

For Each sh In ThisWorkbook.Worksheets
With sh
.Range("E4").Value = Astr(N)
End With
Next sh
Worksheets.PrintOut
Next N
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Peter" wrote in message ...
Hi Ron,
Thanks for the dot =)
Unfortunatly it's still not printing the sheets the way they should be.

It dosn't seem to stop after it enters the new text into "B4" and print what
is on the sheets.
It should do this:
<=====call sub client_copy
Change B4 to Client Copy on all sheets.
Print all sheets
<=====call sub admin_copy
Change B4 to Admin Copy on all sheets
Print all sheets
<=====call sub delivery_copy
Change B4 to Delivery Copy on all sheets
Print all sheets
<=====call sub dock_copy
Change B4 to Dock Copy on all sheets
Print all sheets

Instead it gives the correct amount of pages, just all with Dock Copy on them.

Any idea's what I may have missed?

Regards
Peter


"Ron de Bruin" wrote:

Hi Peter

You missed a dot before .Range(............

Sub delivery_copy()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
With sh
.Range("E4").Value = "Delivery Copy"
End With
Next sh
Worksheets.PrintOut
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Peter" wrote in message ...
Hello All..

I am trying to get my worksheets to play nicely..but no success.

I have say 10 worksheets, and in cell "B4" I have Client Copy (across all
sheets), so it needs to print all those sheets...
Then I need to change "B4" to Delivery Copy, then print all those sheets,
etc etc

Problem is at the moment, it goes through all the sheets, and only prints
the Dock Copy sheets (the last set). I see the text at "B4" change to what it
should, but just keeps going and ignoring the print call.

Sub delivery_copy()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
With sh
Range("E4").Select
ActiveCell = "Delivery Copy"
End With
Next sh
Worksheets.PrintOut

End Sub

I am using this in four seperate modules, each called from Sub
Workbook_BeforePrint.
As always, any advice is welcomed.

Regards
Peter







  #7   Report Post  
Peter
 
Posts: n/a
Default

Hi Ken,
Sorry, still doing it with your suggestion as well...
Is it possible that another macro is interfering with it?
I have run all these attempts from the macro run command as well as in the
Workbook module. Same result each time though.

Regards
Peter (with slightly less but more grey hair)

"Ken Wright" wrote:

How about a single routine that does all 4 prints. Not tested, but

Sub delivery_copy()

Dim sh As Worksheet
Dim myval As String

For x = 1 To 4
Select Case x
Case 1: myval = "Client Copy"
Case 2: myval = "Delivery Copy"
Case 3: myval = "Filing Copy"
Case 4: myval = "Dock Copy"
End Select

For Each sh In ThisWorkbook.Worksheets
sh.Range("E4").Value = myval
Next sh
Worksheets.PrintOut
Next x

End Sub

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"Peter" wrote in message
...
Hello All..

I am trying to get my worksheets to play nicely..but no success.

I have say 10 worksheets, and in cell "B4" I have Client Copy (across all
sheets), so it needs to print all those sheets...
Then I need to change "B4" to Delivery Copy, then print all those sheets,
etc etc

Problem is at the moment, it goes through all the sheets, and only prints
the Dock Copy sheets (the last set). I see the text at "B4" change to what

it
should, but just keeps going and ignoring the print call.

Sub delivery_copy()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
With sh
Range("E4").Select
ActiveCell = "Delivery Copy"
End With
Next sh
Worksheets.PrintOut

End Sub

I am using this in four seperate modules, each called from Sub
Workbook_BeforePrint.
As always, any advice is welcomed.

Regards
Peter




  #8   Report Post  
Ron de Bruin
 
Posts: n/a
Default

Hi Peter

It is working for me.
Send me your test workbook private and I take a look at it.



--
Regards Ron de Bruin
http://www.rondebruin.nl



"Peter" wrote in message ...
Thanks Again Ron,
Still doing exactly the same thing though.

It cycles through all the page names on each page then prints only the last
one.

The page about to be printed pop's up on screen, then the B4 range changes
really fast from Client Copy through to Dock Copy, then prints the Dock Copy.

Regards
Peter

"Ron de Bruin" wrote:

Try this (all in one sub)

Sub Printtest()
Dim sh As Worksheet
Dim Astr
Dim N As Long

Astr = Array("Delivery Copy", "Client Copy", "Admin Copy", "dock_copy")
For N = LBound(Astr) To UBound(Astr)

For Each sh In ThisWorkbook.Worksheets
With sh
.Range("E4").Value = Astr(N)
End With
Next sh
Worksheets.PrintOut
Next N
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Peter" wrote in message ...
Hi Ron,
Thanks for the dot =)
Unfortunatly it's still not printing the sheets the way they should be.

It dosn't seem to stop after it enters the new text into "B4" and print what
is on the sheets.
It should do this:
<=====call sub client_copy
Change B4 to Client Copy on all sheets.
Print all sheets
<=====call sub admin_copy
Change B4 to Admin Copy on all sheets
Print all sheets
<=====call sub delivery_copy
Change B4 to Delivery Copy on all sheets
Print all sheets
<=====call sub dock_copy
Change B4 to Dock Copy on all sheets
Print all sheets

Instead it gives the correct amount of pages, just all with Dock Copy on them.

Any idea's what I may have missed?

Regards
Peter


"Ron de Bruin" wrote:

Hi Peter

You missed a dot before .Range(............

Sub delivery_copy()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
With sh
.Range("E4").Value = "Delivery Copy"
End With
Next sh
Worksheets.PrintOut
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Peter" wrote in message ...
Hello All..

I am trying to get my worksheets to play nicely..but no success.

I have say 10 worksheets, and in cell "B4" I have Client Copy (across all
sheets), so it needs to print all those sheets...
Then I need to change "B4" to Delivery Copy, then print all those sheets,
etc etc

Problem is at the moment, it goes through all the sheets, and only prints
the Dock Copy sheets (the last set). I see the text at "B4" change to what it
should, but just keeps going and ignoring the print call.

Sub delivery_copy()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
With sh
Range("E4").Select
ActiveCell = "Delivery Copy"
End With
Next sh
Worksheets.PrintOut

End Sub

I am using this in four seperate modules, each called from Sub
Workbook_BeforePrint.
As always, any advice is welcomed.

Regards
Peter









  #9   Report Post  
Ken Wright
 
Posts: n/a
Default

Please let us know Ron, because I'm curious now as well :-)

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------
<snip


  #10   Report Post  
Ron de Bruin
 
Posts: n/a
Default

Hi Ken

The problem was that Peter have a sheet event running on the workbook

This is working

Sub Printtest()
Dim sh As Worksheet
Dim Astr
Dim N As Long
Application.EnableEvents = False
Astr = Array("Delivery Copy", "Client Copy", "Admin Copy", "dock_copy")
For N = LBound(Astr) To UBound(Astr)

For Each sh In ThisWorkbook.Worksheets
With sh
.Range("E4").Value = Astr(N)
End With
Next sh
Worksheets.PrintOut
Next N
Application.EnableEvents = True
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl



"Ken Wright" wrote in message ...
Please let us know Ron, because I'm curious now as well :-)

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------
<snip






  #11   Report Post  
Ken Wright
 
Posts: n/a
Default

Cheers Ron :-)

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------
<snip


  #12   Report Post  
Peter
 
Posts: n/a
Default

Thankyou Ron for the excellent detective work...
I never even realised it was running in the background.
All working like a charm =)

Regards
Peter

"Peter" wrote:

Hi Ken,
Sorry, still doing it with your suggestion as well...
Is it possible that another macro is interfering with it?
I have run all these attempts from the macro run command as well as in the
Workbook module. Same result each time though.

Regards
Peter (with slightly less but more grey hair)

"Ken Wright" wrote:

How about a single routine that does all 4 prints. Not tested, but

Sub delivery_copy()

Dim sh As Worksheet
Dim myval As String

For x = 1 To 4
Select Case x
Case 1: myval = "Client Copy"
Case 2: myval = "Delivery Copy"
Case 3: myval = "Filing Copy"
Case 4: myval = "Dock Copy"
End Select

For Each sh In ThisWorkbook.Worksheets
sh.Range("E4").Value = myval
Next sh
Worksheets.PrintOut
Next x

End Sub

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"Peter" wrote in message
...
Hello All..

I am trying to get my worksheets to play nicely..but no success.

I have say 10 worksheets, and in cell "B4" I have Client Copy (across all
sheets), so it needs to print all those sheets...
Then I need to change "B4" to Delivery Copy, then print all those sheets,
etc etc

Problem is at the moment, it goes through all the sheets, and only prints
the Dock Copy sheets (the last set). I see the text at "B4" change to what

it
should, but just keeps going and ignoring the print call.

Sub delivery_copy()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
With sh
Range("E4").Select
ActiveCell = "Delivery Copy"
End With
Next sh
Worksheets.PrintOut

End Sub

I am using this in four seperate modules, each called from Sub
Workbook_BeforePrint.
As always, any advice is welcomed.

Regards
Peter




  #13   Report Post  
Ron de Bruin
 
Posts: n/a
Default

Thanks for the feedback Peter

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Peter" wrote in message ...
Thankyou Ron for the excellent detective work...
I never even realised it was running in the background.
All working like a charm =)

Regards
Peter

"Peter" wrote:

Hi Ken,
Sorry, still doing it with your suggestion as well...
Is it possible that another macro is interfering with it?
I have run all these attempts from the macro run command as well as in the
Workbook module. Same result each time though.

Regards
Peter (with slightly less but more grey hair)

"Ken Wright" wrote:

How about a single routine that does all 4 prints. Not tested, but

Sub delivery_copy()

Dim sh As Worksheet
Dim myval As String

For x = 1 To 4
Select Case x
Case 1: myval = "Client Copy"
Case 2: myval = "Delivery Copy"
Case 3: myval = "Filing Copy"
Case 4: myval = "Dock Copy"
End Select

For Each sh In ThisWorkbook.Worksheets
sh.Range("E4").Value = myval
Next sh
Worksheets.PrintOut
Next x

End Sub

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"Peter" wrote in message
...
Hello All..

I am trying to get my worksheets to play nicely..but no success.

I have say 10 worksheets, and in cell "B4" I have Client Copy (across all
sheets), so it needs to print all those sheets...
Then I need to change "B4" to Delivery Copy, then print all those sheets,
etc etc

Problem is at the moment, it goes through all the sheets, and only prints
the Dock Copy sheets (the last set). I see the text at "B4" change to what
it
should, but just keeps going and ignoring the print call.

Sub delivery_copy()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
With sh
Range("E4").Select
ActiveCell = "Delivery Copy"
End With
Next sh
Worksheets.PrintOut

End Sub

I am using this in four seperate modules, each called from Sub
Workbook_BeforePrint.
As always, any advice is welcomed.

Regards
Peter






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
Printing switches focus off proper sheet Abi Excel Worksheet Functions 1 January 26th 05 07:42 PM
problem printing to PDF mark kubicki Excel Discussion (Misc queries) 1 January 21st 05 06:19 PM
Excel 2002 Printing nannapat Excel Discussion (Misc queries) 1 January 18th 05 02:30 PM
Weird Printing problems with spreadsheet fec Setting up and Configuration of Excel 1 November 29th 04 09:56 PM
Enable Double sided printing contiuously when printing multiple s. Lee Excel Discussion (Misc queries) 1 November 27th 04 01:58 AM


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