Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I mail merge to EMAIL from MS Word AND add a pdf attachment | Mailmerge | |||
Barcode Mail Merge Documetns | Mailmerge | |||
Inserting a new label in a mail merge | Microsoft Word Help | |||
Mail Merge Inserting 0's | Mailmerge | |||
mail merge doesn't use custom font | Mailmerge |