Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
hans hans is offline
external usenet poster
 
Posts: 72
Default VB help with serialized printing macro?

I found some VB on the web to allow me to assign a unique number to multiple
printed docs. The macro works -- mostly: If I print, say, 5 copies, the
*first* copy only is not numbered, but subsequent copies are, up through 4.

My VB is rusty (took a "101" class 5 or 6 years ago, then never used it).
Can someone tell me what's wrong with the code? Or, if there is another form
at which this type of question should be posed, could someone point the way?
*Or*, point me in the direction of a similar but wholly functional macro?

----------------------------------------------
Sub MySerial()
Dim rngSerialLocation As Range
Dim intSerialNum As Integer
Dim strSerialNum As String
Dim docCurrent As Document
Dim intNumCopies As Integer
Dim intCount As Integer

' set ref to current active doc
Set docCurrent = Application.ActiveDocument
' set ref to the bookmarked serial number
Set rngSerialLocation = docCurrent.Bookmarks("Serial").Range

' get the starting number
intSerialNum = Val(rngSerialLocation.Text)
' get the number of copies required
intNumCopies = Val(InputBox$("How many Copies?", _
"Print Serialized", "1"))

For intCount = 1 To intNumCopies
' print the document
docCurrent.PrintOut Range:=wdPrintAllDocument
' increment the serial number
intSerialNum = intSerialNum + 1
' put into formatted version
strSerialNum = Format(intSerialNum, "00000")
' stuff into proper place
rngSerialLocation.Text = strSerialNum
Next intCount

' reset the bookmark, since the updating procedure
' wipes out the old one
docCurrent.Bookmarks.Add Name:="Serial", _
Range:=rngSerialLocation
End Sub

----------------------------------------------

Thank you...

-Hans
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
garfield-n-odie [MVP] garfield-n-odie [MVP] is offline
external usenet poster
 
Posts: 2,587
Default VB help with serialized printing macro?

See http://word.mvps.org/FAQs/MacrosVBA/...piesOf1Doc.htm and
http://www.gmayor.com/installing_macro.htm .

Hans wrote:

I found some VB on the web to allow me to assign a unique number to multiple
printed docs. The macro works -- mostly: If I print, say, 5 copies, the
*first* copy only is not numbered, but subsequent copies are, up through 4.

My VB is rusty (took a "101" class 5 or 6 years ago, then never used it).
Can someone tell me what's wrong with the code? Or, if there is another form
at which this type of question should be posed, could someone point the way?
*Or*, point me in the direction of a similar but wholly functional macro?

----------------------------------------------
Sub MySerial()
Dim rngSerialLocation As Range
Dim intSerialNum As Integer
Dim strSerialNum As String
Dim docCurrent As Document
Dim intNumCopies As Integer
Dim intCount As Integer

' set ref to current active doc
Set docCurrent = Application.ActiveDocument
' set ref to the bookmarked serial number
Set rngSerialLocation = docCurrent.Bookmarks("Serial").Range

' get the starting number
intSerialNum = Val(rngSerialLocation.Text)
' get the number of copies required
intNumCopies = Val(InputBox$("How many Copies?", _
"Print Serialized", "1"))

For intCount = 1 To intNumCopies
' print the document
docCurrent.PrintOut Range:=wdPrintAllDocument
' increment the serial number
intSerialNum = intSerialNum + 1
' put into formatted version
strSerialNum = Format(intSerialNum, "00000")
' stuff into proper place
rngSerialLocation.Text = strSerialNum
Next intCount

' reset the bookmark, since the updating procedure
' wipes out the old one
docCurrent.Bookmarks.Add Name:="Serial", _
Range:=rngSerialLocation
End Sub

----------------------------------------------

Thank you...

-Hans


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
hans hans is offline
external usenet poster
 
Posts: 72
Default VB help with serialized printing macro?

Thank you -- I'll check out the other macro...

Regards,

-Hans

"garfield-n-odie [MVP]" wrote:

See http://word.mvps.org/FAQs/MacrosVBA/...piesOf1Doc.htm and
http://www.gmayor.com/installing_macro.htm .

Hans wrote:

I found some VB on the web to allow me to assign a unique number to multiple
printed docs. The macro works -- mostly: If I print, say, 5 copies, the
*first* copy only is not numbered, but subsequent copies are, up through 4.

My VB is rusty (took a "101" class 5 or 6 years ago, then never used it).
Can someone tell me what's wrong with the code? Or, if there is another form
at which this type of question should be posed, could someone point the way?
*Or*, point me in the direction of a similar but wholly functional macro?

----------------------------------------------
Sub MySerial()
Dim rngSerialLocation As Range
Dim intSerialNum As Integer
Dim strSerialNum As String
Dim docCurrent As Document
Dim intNumCopies As Integer
Dim intCount As Integer

' set ref to current active doc
Set docCurrent = Application.ActiveDocument
' set ref to the bookmarked serial number
Set rngSerialLocation = docCurrent.Bookmarks("Serial").Range

' get the starting number
intSerialNum = Val(rngSerialLocation.Text)
' get the number of copies required
intNumCopies = Val(InputBox$("How many Copies?", _
"Print Serialized", "1"))

For intCount = 1 To intNumCopies
' print the document
docCurrent.PrintOut Range:=wdPrintAllDocument
' increment the serial number
intSerialNum = intSerialNum + 1
' put into formatted version
strSerialNum = Format(intSerialNum, "00000")
' stuff into proper place
rngSerialLocation.Text = strSerialNum
Next intCount

' reset the bookmark, since the updating procedure
' wipes out the old one
docCurrent.Bookmarks.Add Name:="Serial", _
Range:=rngSerialLocation
End Sub

----------------------------------------------

Thank you...

-Hans



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing Macro traineeross Microsoft Word Help 1 June 26th 07 02:54 PM
Creating a macro to run a merge and then printing , then save Bruce Mailmerge 1 December 17th 06 05:24 PM
Help needed w/booklet-printing macro, round 2 David Nebenzahl Page Layout 5 March 14th 06 05:19 AM
Help needed: booklet-printing macro not working correctly David Nebenzahl Page Layout 3 March 11th 06 10:43 PM
printing labels from a form using a macro mary Formatting Long Documents 5 May 14th 05 09:09 AM


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

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"