View Single Post
  #9   Report Post  
gocats
 
Posts: n/a
Default

Thanks Dave

I was afraid it couldn't be done.

"Dave Peterson" wrote:

If you use the built in dialog to print, then I don't think you're gonna have
enough control over what happens next.

I'd use that dedicated macro to print.

gocats wrote:

Dave

I would like to go File/Print/number of copies etc and have VB restrict the
number of copies per packet less than 20 and when completed pass then next
packet of less than 20 etc.

When I run your routine below it displays a message box asking for the
number of copies which is not quite the same as using the menu selection or
am I missing something?

"Dave Peterson" wrote:

Copies has to be a number and =20 isn't a number.

I'm not sure what you mean by the message box stuff.



gocats wrote:

Dave

I would like to use "ActiveWindow.SelectedSheets.PrintOut Copies:=20" but I
cannot seem able to incorporate this in a if statement and have correct
syntax. I would prefer this than a message box from an independant macro.

"Dave Peterson" wrote:

You could add a line like:

application.wait now + timeserial(0,10,0)

to wait 10 seconds.

Put it right before (or after) the .printout line.



gocats wrote:

Thanks Dave,

Before I test it, what do I require at the start for it to be in VB code,
and how can I alter the time delay before the next 'batch' is sent?

"Dave Peterson" wrote:

Maybe you could use a macro to print what you want in groups of 20.

Option Explicit
Sub testme()

Dim HowManyTotal As Long
Dim HowManyPerGroup As Long
Dim HowManyLastTime As Long
Dim HowManyThisTime As Long
Dim MaxTimes As Long
Dim pCtr As Long

HowManyPerGroup = 20

HowManyTotal = CLng(Application.InputBox(prompt:="how many copies", _
Type:=1))

If HowManyTotal < 1 Then
Exit Sub
End If

MaxTimes = HowManyTotal \ HowManyPerGroup
HowManyLastTime = HowManyTotal Mod HowManyPerGroup

If HowManyLastTime = 0 Then
'evenly divided
HowManyLastTime = HowManyPerGroup
Else
'oh,oh, there was a remainder
'(ask for 312 in groups of 20 means the last time will get 12)
'get those last few
MaxTimes = MaxTimes + 1
End If

For pCtr = 1 To MaxTimes
If pCtr = MaxTimes Then
HowManyThisTime = HowManyLastTime
Else
HowManyThisTime = HowManyPerGroup
End If
ActiveSheet.PrintOut preview:=True, copies:=HowManyThisTime
Next pCtr

End Sub

I print previewed the activesheet. Remove the preview:=true and change what you
want printed when you're done testing.

gocats wrote:

Despite upgraging the printer memory, if the number of print copies is less
than 20 , the laser churns out the copies one after the other. However if
when say 100 print copies is requested, the printer slows between copies as I
understand the buffer is full. How can the number of copies be automated so
that up to 20 print copies per 'batch' is sent and when done the next 'batch'
of up to 20 is sent until the total number print copies is done.

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson