Results 1 to 10 of 10

Thread: Printing Labels

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    Dallas, TX
    Posts
    89
    Hi all,

    I was wondering if anyone had a program to print labels.
    i would be printing the labels on an old dot matrix printer,
    on Avery Style labels. Or if someone could point me in the
    right direction as to how and where I would get started. Any
    code would be very helpful.
    ande211
    VB6 SP3

  2. #2
    Guest
    Try this.
    Code:
    Printer.Print Label1.Caption
    Printer.EndDoc

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    I don't think he wanted to print out the caption of a VB Label control but to print on labels (Avery Style labels).

    Why don't you try to automate Word to do this for you.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    Dallas, TX
    Posts
    89
    Megatron,

    Tahnks for your reply. I also would like to know how I
    set the spacing for the labels. Like I said before i will
    be printing on "Avery Style" labels. I am printing addresses
    and I need to know how to set up the spacing for each label.
    The labels are something like 3" by 1".
    ande211
    VB6 SP3

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    Dallas, TX
    Posts
    89
    I need to set this up so that users can use it. Something simple, so Word is not an option. Thanks for the suggestion
    though.
    ande211
    VB6 SP3

  6. #6
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242
    Try with Printer object:
    Code:
    Dim DifferenceBetweenLabels 'space between labels
    Dim LabelHeight 'height of label
    Printer.FontName="Tahoma"
    Printer.FontSize=11
    Printer.ScaleMode=vbCentimeters
    Printer.CurrentX=1.5
    Printer.n
    For i=0 To NoOfLabels-1
       Printer.CurrentY=i*(DifferenceBetweenLabels+LabelHeight) + 2
       Printer.Print "";
       Printer.Print "Name"; 'semicolon tells VB to go to new line
       Printer.CurrentY=i*(DifferenceBetweenLabels+LabelHeight) + 2.5
       Printer.Print "Address";
       Printer.CurrentY=i*(DifferenceBetweenLabels+LabelHeight) + 3
       Printer.Print "City";
       Printer.CurrentY=i*(DifferenceBetweenLabels+LabelHeight) + 3.5
       Printer.Print "State";
    Next
    This example will print one column of labels on paper.

    Hope I helped
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  7. #7
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242
    I forgot...
    When you end printing, you must write
    Code:
    Printer.EndDoc
    because if you don't nothing will come out from printer.
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    Dallas, TX
    Posts
    89
    Zvonko,

    Thanks for your reply. I'll try it and see what happens.
    ande211
    VB6 SP3

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    Dallas, TX
    Posts
    89
    Zvonko,

    Hey can you tell me what this code does (Printer.n)?
    I'm getting an error and that'swhere it tells me the error is. Was that just a typeo or something?
    ande211
    VB6 SP3

  10. #10
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242
    Damn!
    Printer.n is just TYPO.
    I tried to write something else, but I didn't and I forgot to delete it. Just ignore that line.
    Sorry again...
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

Posting Permissions

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



Click Here to Expand Forum to Full Width