Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / September 2006

Tip: Looking for answers? Try searching our database.

Mail merge - Inserting custom barcode

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Poludasu - 11 Sep 2006 16:26 GMT
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.
Peter Jamieson - 11 Sep 2006 17:14 GMT
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
>I am having trouble inserting custom barcode with mail merge fileds.
>
[quoted text clipped - 30 lines]
>
> Thank you.
Poludasu - 11 Sep 2006 17:25 GMT
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.

> 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
[quoted text clipped - 43 lines]
> >
> > Thank you.
Peter Jamieson - 11 Sep 2006 18:23 GMT
> 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
> Thanks for the info.
> PCSBarCd is the name I created for a third party "TALBarCd" barcode
[quoted text clipped - 58 lines]
>> >
>> > Thank you.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.