View Single Post
  #9  
Old December 27th 08, 08:41 AM posted to microsoft.public.word.mailmerge.fields
Graham Mayor
external usenet poster
 
Posts: 19,312
Default last numbers of the record

Is this any easier than manually inputting the number and re-propagating the
labels? The problem with editing the data source in this way is that it only
works if you merge the full data source. It completely falls apart if you
only merge part of the data.

One possibility is to store the variable number in a docvariable and use a
docvariable field to display the total record count.e.g.

{ MERGEREC }{ DOCVARIABLE varLabelCount }

Use the following macro to update the docvariable before running the merge
to produce

1/229

Dim oVars As Variables
Dim sAsk As String
Dim i As Long
Set oVars = ActiveDocument.Variables
sAsk = InputBox("Total number of labels for this merge", "Labels")
oVars("varLabelCount").Value = _
"/" & sAsk
For i = ActiveDocument.Fields.Count To 1 Step -1
With ActiveDocument.Fields(i)
If .Type = wdFieldDocVariable Then .Update
End With
Next i

http://www.gmayor.com/installing_macro.htm
--

Graham Mayor - Word MVP

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




dilbert firestorm wrote:
I don't have access to word as I'm on vacation, but will this idea work?
make another column and use that column for the number since I know
the exact # from the inventory. the entire column would be filled
with "13" as last number. This prolly would work.

Is there a better way to do this?

Peter Jamieson wrote:
If the data source is Word, there's no particularly easy/automatic
way to get the record count - you may be able to find it in Edit
Recipients fairly easily and insert it in the Mail Merge Main
document, but that's about it. (For other types of data source you
can consider inserting a DATABASE field, outside the table of
labels, that does a SQL SELECT count(*) FROM thedatasourcetablname,
but even that will not help if you are doing selections in Edit
Recipients). Peter Jamieson

http://tips.pjmsn.me.uk

dilbert firestorm wrote:
Peter Jamieson wrote:
What type of datasource is your table? which version of Word?


Peter Jamieson

http://tips.pjmsn.me.uk

dilbert firestorm wrote:
is there anyway to include the last # of a record on a label?
I'm trying to get the label to show as 1/10, 2/10,, etc. from a
table.

my mistake. I'm doing this off of a word processor. Its microsoft
word, not excel. I don't remember what version of word it was. the
data source is mostly dates & numbers.

there is a mail merge switch that sort of lets you append a text to
the mailmerge field, but the thing is I'd have to cut & past for
each table cell if I remember to do this. If I don't, the labels
are wasted.



Ads