Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Poludasu Poludasu is offline
external usenet poster
 
Posts: 2
Default Mail merge - Inserting custom barcode

I am having trouble inserting custom barcode with mail merge fileds.

With ActiveDocument.MailMerge

'get the record count of the datasource
With .DataSource
.ActiveRecord = wdLastRecord
x = .ActiveRecord
'set the activerecord back to the first
.ActiveRecord = wdFirstRecord
y = .ActiveRecord
End With


'loop the datasource count and merge one record at a time
For i = 1 To x
.DataSource.FirstRecord = i
.DataSource.LastRecord = i
PCSBarCd.Message = .DataSource.DataFields("Nick").Value & "|" &
..DataSource.DataFields("Last").Value & "|" &
..DataSource.DataFields("Branch").Value & "|" &
..DataSource.DataFields("Branch_Name").Value & "|" &
..DataSource.DataFields("Branch_Phone").Value
.Destination = wdSendToNewDocument

.Execute Pause:=False
Next i
End With


The above code generates a bar code for all the records, but opens up a new
document for each excel record. I would like to mimic the "Merge to a new
document" functionality with barcodes.

Thank you.
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Mail merge - Inserting custom barcode

What does the assinment (PCSBarCd.Message = ) actually do? If you /have/ to
be able to call a method or function during the merge to get the output you
need, I think you will have to use Word's Mail Merge events in order to do
it. otherwise, if all you need to be able to do is create a string in the
document that uses a particular font, then either
a. you can build the string using field results and ordianry characters
(such as "|") in which case you may not need any VB/VBA code at all (put the
right fields and text in your document and apply the right font) or
b. you have to process the fields and text in some way, e.g. to add a
checksum, in which case you /might/ be able to do it in the data source.
Otherwise you will probably need to use Word's Mail merge events.

Peter Jamieson
"Poludasu" wrote in message
...
I am having trouble inserting custom barcode with mail merge fileds.

With ActiveDocument.MailMerge

'get the record count of the datasource
With .DataSource
.ActiveRecord = wdLastRecord
x = .ActiveRecord
'set the activerecord back to the first
.ActiveRecord = wdFirstRecord
y = .ActiveRecord
End With


'loop the datasource count and merge one record at a time
For i = 1 To x
.DataSource.FirstRecord = i
.DataSource.LastRecord = i
PCSBarCd.Message = .DataSource.DataFields("Nick").Value & "|" &
.DataSource.DataFields("Last").Value & "|" &
.DataSource.DataFields("Branch").Value & "|" &
.DataSource.DataFields("Branch_Name").Value & "|" &
.DataSource.DataFields("Branch_Phone").Value
.Destination = wdSendToNewDocument

.Execute Pause:=False
Next i
End With


The above code generates a bar code for all the records, but opens up a
new
document for each excel record. I would like to mimic the "Merge to a new
document" functionality with barcodes.

Thank you.



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Poludasu Poludasu is offline
external usenet poster
 
Posts: 2
Default Mail merge - Inserting custom barcode

Thanks for the info.
PCSBarCd is the name I created for a third party "TALBarCd" barcode control.
To generate the barcode, message property is used.
Peter, I am novice to this word macros stuff. Can you please point me in a
right direction to what these mail merge events are and how to use them.
Links to any documentation is appreciated.

Thank you so much.

"Peter Jamieson" wrote:

What does the assinment (PCSBarCd.Message = ) actually do? If you /have/ to
be able to call a method or function during the merge to get the output you
need, I think you will have to use Word's Mail Merge events in order to do
it. otherwise, if all you need to be able to do is create a string in the
document that uses a particular font, then either
a. you can build the string using field results and ordianry characters
(such as "|") in which case you may not need any VB/VBA code at all (put the
right fields and text in your document and apply the right font) or
b. you have to process the fields and text in some way, e.g. to add a
checksum, in which case you /might/ be able to do it in the data source.
Otherwise you will probably need to use Word's Mail merge events.

Peter Jamieson
"Poludasu" wrote in message
...
I am having trouble inserting custom barcode with mail merge fileds.

With ActiveDocument.MailMerge

'get the record count of the datasource
With .DataSource
.ActiveRecord = wdLastRecord
x = .ActiveRecord
'set the activerecord back to the first
.ActiveRecord = wdFirstRecord
y = .ActiveRecord
End With


'loop the datasource count and merge one record at a time
For i = 1 To x
.DataSource.FirstRecord = i
.DataSource.LastRecord = i
PCSBarCd.Message = .DataSource.DataFields("Nick").Value & "|" &
.DataSource.DataFields("Last").Value & "|" &
.DataSource.DataFields("Branch").Value & "|" &
.DataSource.DataFields("Branch_Name").Value & "|" &
.DataSource.DataFields("Branch_Phone").Value
.Destination = wdSendToNewDocument

.Execute Pause:=False
Next i
End With


The above code generates a bar code for all the records, but opens up a
new
document for each excel record. I would like to mimic the "Merge to a new
document" functionality with barcodes.

Thank you.




  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Mail merge - Inserting custom barcode

Can you please point me in a
right direction to what these mail merge events are and how to use them.
Links to any documentation is appreciated.


1. Look at the material on Word Events in the Word VBA Help.

2. search Google groups for "jamieson EventClassModule" (without the quotes)
for some very simple code (recent messages may be better)

3. There are some problems, e.g.
a. some people do not seem to be able to get the events to fire for more
than one a few records
b. the "before merge" event only fires if the user initiates the merge from
the Mail Merge Wizard.

Peter Jamieson
"Poludasu" wrote in message
...
Thanks for the info.
PCSBarCd is the name I created for a third party "TALBarCd" barcode
control.
To generate the barcode, message property is used.
Peter, I am novice to this word macros stuff. Can you please point me in a
right direction to what these mail merge events are and how to use them.
Links to any documentation is appreciated.

Thank you so much.

"Peter Jamieson" wrote:

What does the assinment (PCSBarCd.Message = ) actually do? If you /have/
to
be able to call a method or function during the merge to get the output
you
need, I think you will have to use Word's Mail Merge events in order to
do
it. otherwise, if all you need to be able to do is create a string in the
document that uses a particular font, then either
a. you can build the string using field results and ordianry characters
(such as "|") in which case you may not need any VB/VBA code at all (put
the
right fields and text in your document and apply the right font) or
b. you have to process the fields and text in some way, e.g. to add a
checksum, in which case you /might/ be able to do it in the data source.
Otherwise you will probably need to use Word's Mail merge events.

Peter Jamieson
"Poludasu" wrote in message
...
I am having trouble inserting custom barcode with mail merge fileds.

With ActiveDocument.MailMerge

'get the record count of the datasource
With .DataSource
.ActiveRecord = wdLastRecord
x = .ActiveRecord
'set the activerecord back to the first
.ActiveRecord = wdFirstRecord
y = .ActiveRecord
End With


'loop the datasource count and merge one record at a time
For i = 1 To x
.DataSource.FirstRecord = i
.DataSource.LastRecord = i
PCSBarCd.Message = .DataSource.DataFields("Nick").Value & "|" &
.DataSource.DataFields("Last").Value & "|" &
.DataSource.DataFields("Branch").Value & "|" &
.DataSource.DataFields("Branch_Name").Value & "|" &
.DataSource.DataFields("Branch_Phone").Value
.Destination = wdSendToNewDocument

.Execute Pause:=False
Next i
End With


The above code generates a bar code for all the records, but opens up a
new
document for each excel record. I would like to mimic the "Merge to a
new
document" functionality with barcodes.

Thank you.






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
How do I mail merge to EMAIL from MS Word AND add a pdf attachment Lily@Insight Mailmerge 24 January 15th 07 09:33 PM
Barcode Mail Merge Documetns Safi Mailmerge 0 August 16th 06 07:54 AM
Inserting a new label in a mail merge outlook lady Microsoft Word Help 3 June 29th 06 07:35 PM
Mail Merge Inserting 0's Bruinsma Mailmerge 1 May 18th 05 07:26 AM
mail merge doesn't use custom font Karl Mailmerge 3 January 19th 05 11:46 PM


All times are GMT +1. The time now is 05:02 PM.

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"