Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print lots of labels

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
US
Hello all!

I have an array of numbers that I need to print through a word document onto little labels. (Using OLE/COM to program throgh DELPHI). So I have the following code:

Word := CreateOleObject('Word.Application');
Word.Visible := True;
wrdDoc := Word.MailingLabel.CreateNewDocument Name:="5167 address", Address:=addr, ExtractAddress:=False

to create a new document of labels, but the help example only shows adding one label. I need to go through the array and place them in order:

barcode(1) row 1 column1
barcode(2) row 2 column1
barcode(3) row 3 column1 until column 1 is filled (20 times) then move to row 1 column 2 for barcode(21).

Make sense?

Any help would be appreciated!

thanks,

leslie
 
Hi Les,

I am no Word VBA guru. I tried recording a mailmerge for your 5167 Return Addredd Labels, BUT the recorder does not work in the wizard.

But I did see <<NextRecord>> on all but the first label. So I looked for Nextrecord in the Word VBE Object Browser and Help. Here's something that may help...
Code:
    With ActiveDocument.MailMerge
        .ViewMailMergeFieldCodes = False
        .DataSource.ActiveRecord = wdNextRecord
    End With
There is a FirstRecord and LastRecord Method, so maybe the FirstRecord Method is what you would use first.

I don't have the time right now to try testing some code. Hope this provide a small amount of help. Skip,
SkipAndMary1017@mindspring.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top