Results 1 to 6 of 6

Thread: Print Function

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    24

    Print Function

    i need help with printing the labels of a form but nothing else can anyone help

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Print Function

    Labels as in standard VB labels?

    How many labels?

    How to you want them to appear on your printed report?

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    24

    Re: Print Function

    there are 6 standard labels 3 with the names of the items in the other 3 and would like them columed

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Print Function

    Ok. Here is how you would print one label
    VB Code:
    1. Private Sub Command1_Click()
    2. Printer.Print Label1.Caption
    3. Printer.EndDoc
    4. End Sub
    Now, in order to print all 6 at the same time you would need to do some looping. How would do that looping depends on whether or not they are in a control array. Are they?

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    24

    Re: Print Function

    they are not in an array

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Print Function

    Try this
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim ctrl As Control
    3.    For Each ctrl In Me.Controls
    4.        If TypeOf ctrl Is Label Then
    5.           Printer.Print ctrl.Caption
    6.        End If
    7.    Next
    8. Printer.EndDoc
    9. End Sub
    It will at least get you started.

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