View Single Post
  #17   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default print receipts with running number without creating many pages

You are welcome

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



jaysan3 wrote:
Many thanks, Graham. The {REF RecNo} was what I was looking for. Just
to put in multiple instances of the serial number. Then I just
changed the font before running the macro.

Thanks again, Graham. You have solved my problem

"Graham Mayor" wrote:

Are you saying that the barcode is simply the serial number
formatted with a barcode font, and thus a duplicate of the number
that the macro creates? That being the case add a REF field where
you want the bar code to appear with a charformat switch as follows

{REF RecNo \*Charformat}

Use CTRL+F9 for the field brackets {} then format the field with
your bar code font. That should work when the macro updates the
field. To facilitate that, replace the first macro with the revised
version below:

Sub AddNoFromINIFileToBookmark()
Dim SettingsFile As String
Dim Order As String
Dim iCount As String
Dim rRecNo As Range
Dim i As Long

iCount = InputBox("Print how many receipts?", _
"Print Receipts", 1)
If iCount = "" Then Exit Sub

SettingsFile = Options.DefaultFilePath(wdStartupPath) &
"\Settings.ini" Order = System.PrivateProfileString(SettingsFile, _
"ReceiptNumber", "Order")
If Order = "" Then
Order = 1
End If
For i = 1 To iCount

Set rRecNo = ActiveDocument.Bookmarks("RecNo").Range
rRecNo.Text = Format(Order, "00000")
With ActiveDocument
.Bookmarks.Add "RecNo", rRecNo
.Fields.Update
.ActiveWindow.View.ShowFieldCodes = False
.PrintOut
End With
Order = Order + 1
Next
System.PrivateProfileString(SettingsFile, "ReceiptNumber", _
"Order") = Order
End Sub

If that is not what you are saying, can you clarify how the bar code
relates to your document and its serial number.

I take it you realise that the number of digits in the number is
created by the format switch in the line

rRecNo.Text = Format(Order, "00000")

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



jaysan3 wrote:
Hi Graham,

Need another help. I would like to put the serial number & barcode
(which is basically just a different font). I cannot repeat
inserting the same bookmark. It seems that I cannot use the same
bookmark at 2 different locations.

Is there any other way besides renaming macros?

"Graham Mayor" wrote:

Graham Mayor wrote:
' ActiveDocument.PrintOut

Oops - You had better remove the apostrophe from the start of the
line above (used while testing) or it won't print )

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org