Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Oct 2003
    Location
    Kent, UK
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Automating label production (Word 2000)

    Hello, me again, always on the scrounge for information.
    I have an autotext text up which is a letter template and prompts me to enter data using fillin fields.
    At the end of the day, I have a document which is full of letters and I want to be able to press a button and have a page of labels appear containing all the names and addresses of the people whom I am writing to.
    I am guessing i need something that looks through the document picking out all my name and address fillin fields and uses maybe mailmerge to put them in a labels document.
    I hope you can help!
    Thanks
    Emily

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Automating label production (Word 2000)

    It would probably be easier to gather the data in a table instead of creating the letters directly, and use that as data source for a mail merge to both letters and labels.

    But it is possible to loop through the fields and fill labels, but the exact code depends on what the label document looks like.

  3. #3
    Star Lounger
    Join Date
    Oct 2003
    Location
    Kent, UK
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automating label production (Word 2000)

    Cheers Hans,
    All the letters in the document have different content so I would like to know how to loop through the fields unless its a major pain.
    The labels I am using are Avery A4 & A5 sizes L7163.
    Emily

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Automating label production (Word 2000)

    Say that you have two fillin fields, the first for the name, the second for the address. The following code will loop through the fillin fields and populate a label document. This version opens a fresh copy of an existing document Labels.doc.

    Sub LoopFillinFields()
    Dim docLetters As Document
    Dim docLabels As Document
    Dim fld As Field
    Dim i As Integer
    Set docLetters = ActiveDocument
    Set docLabels = Documents.Add("Labels.doc")
    For Each fld In docLetters.Fields
    If fld.Type = wdFieldFillIn Then
    i = i + 1
    With docLabels.Windows(1).Selection
    .TypeText fld.Result
    If i Mod 2 = 1 Then
    .TypeParagraph
    Else
    .MoveRight Unit:=wdCell, Count:=(i / 2) Mod 2 + 1
    End If
    End With
    End If
    Next fld
    End Sub

    If you have more fillin fields, the code will have to change.

  5. #5
    Star Lounger
    Join Date
    Oct 2003
    Location
    Kent, UK
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automating label production (Word 2000)

    Great! Thanks Hans.
    As it happens I have only two fillin fields.
    I'll give it a bash.
    Thanks again
    Emily

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •