|
-
Feb 26th, 2003, 05:03 PM
#1
Thread Starter
Lively Member
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
-
Feb 26th, 2003, 10:05 PM
#2
Member
u want to print controls names?
hi
u want to print control names ?
-
Feb 27th, 2003, 12:39 PM
#3
Hyperactive Member
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
-
Feb 27th, 2003, 04:28 PM
#4
-= B u g S l a y e r =-
I made this sample a long time ago, I think its something like this you are after 
VB Code:
Private Sub PrintTheControls(frm As Form)
Dim c As Control
Dim p As Printer
Set p = Printer
For Each c In frm
If TypeOf c Is TextBox Then
p.CurrentX = c.Left
p.CurrentY = c.Top
p.Font = c.Font
p.Print c.Text
End If
If TypeOf c Is Label Then
p.CurrentX = c.Left
p.CurrentY = c.Top
p.Font = c.Font
p.Print c.Caption
End If
Next c
p.EndDoc
End Sub
Private Sub Command1_Click()
PrintTheControls Me
End Sub
-
Feb 28th, 2003, 03:05 AM
#5
Thread Starter
Lively Member
hi peet
thnx for that
i getting de bug object required on this line:
p.CurrentX = c.Left
what is actually currentX and currentY
-
Feb 28th, 2003, 04:28 AM
#6
-= B u g S l a y e r =-
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 ?
-
Mar 4th, 2003, 06:17 PM
#7
Thread Starter
Lively Member
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
-
Mar 5th, 2003, 01:21 AM
#8
-= B u g S l a y e r =-
hi again shaker 
could you show me the code you are using ?
-
Mar 5th, 2003, 08:55 AM
#9
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|