Results 1 to 9 of 9

Thread: printing

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Location
    Sydney
    Posts
    107

    printing

    Hi
    On my form i created a aprint button, me.printform, works fine but my question is instead of printing the whole form how can just print whatever is in the labels and in the text boxes in order ie.

    label1 ....text box1
    label2.....textbox2
    label3....texbox3
    etc
    Thnx In Advance

  2. #2
    Member
    Join Date
    Jan 2003
    Location
    singpaore
    Posts
    42

    u want to print controls names?

    hi

    u want to print control names ?

  3. #3
    Hyperactive Member Rocketdawg's Avatar
    Join Date
    Feb 2003
    Location
    Back in the doghouse
    Posts
    294

    SelText and Text

    KVReddy

    If you want to save the text in a textbox or just the
    highlighted (seltext), you can use a common dialog
    (.showprint).
    If that's what you have in mind, let me know and I'll
    post some code.

    Dawg

  4. #4
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    I made this sample a long time ago, I think its something like this you are after

    VB Code:
    1. Private Sub PrintTheControls(frm As Form)
    2.     Dim c As Control
    3.     Dim p As Printer
    4.     Set p = Printer
    5.    
    6.     For Each c In frm
    7.          If TypeOf c Is TextBox Then
    8.             p.CurrentX = c.Left
    9.             p.CurrentY = c.Top
    10.             p.Font = c.Font
    11.             p.Print c.Text
    12.          End If
    13.          If TypeOf c Is Label Then
    14.             p.CurrentX = c.Left
    15.             p.CurrentY = c.Top
    16.             p.Font = c.Font
    17.             p.Print c.Caption
    18.          End If
    19.     Next c
    20.     p.EndDoc
    21. End Sub
    22.  
    23. Private Sub Command1_Click()
    24.     PrintTheControls Me
    25. End Sub
    -= a peet post =-

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Location
    Sydney
    Posts
    107
    hi peet
    thnx for that
    i getting de bug object required on this line:
    p.CurrentX = c.Left

    what is actually currentX and currentY
    Thnx In Advance

  6. #6
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    with currentx and currenty you tell the printer where you want to start printing on a page.

    have you used an exact copy of what I posted ?
    -= a peet post =-

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Location
    Sydney
    Posts
    107
    hi peet,
    sorry didn't reply back straight away work on another part of the project and came back to this with fresh head well thought it was fresh lol
    yes i did copy exact code..it prints but some lines on top of ech other and all over the place thats whats confusing me
    Thnx In Advance

  8. #8
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    hi again shaker

    could you show me the code you are using ?
    -= a peet post =-

  9. #9
    Hyperactive Member Rocketdawg's Avatar
    Join Date
    Feb 2003
    Location
    Back in the doghouse
    Posts
    294

    Printing

    Hi Guys

    Here's a basic snippet that uses the common dialog. I use a
    modified version to send little stuff to the network laser. You can modify it (font, ad infinitum) however you want.

    On Error Resume Next
    With CommonDialog1
    .PrinterDefault = True
    .Flags = cdlPDDisablePrintToFile Or cdlPDNoPageNums
    If Text1.SelLength = 0 Then
    .Flags = .Flags Or cdlPDNoSelection
    Else
    .Flags = .Flags Or cdlPDSelection
    End If
    .CancelError = True
    .ShowPrinter
    If Err = 0 Then
    If .Flags And cdlPDSelection Then
    Printer.Print Text1.SelText
    Else
    Printer.Print Text1.Text
    End If
    End If
    End With

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