VBA: The code to Print content of a textbox
Hello,
I'm making an application in VBA (EXCEL) for college work.
I'm tryin to print the content of a textbox -its as simple as that!
I tried using VB code int print click event:
Private Sub cmdPrintDetails_Click()
Printer.Print txtItemName.text
Printer.EndDoc
End Sub
I get an error message " '424' Object required"
Does any one know the code i'm supposed to use for this?
Appreciate quick reply in a hurry.
Thanks,
K
[553 byte] By [
kalio17] at [2007-11-18 20:32:06]

# 1 Re: VBA: The code to Print content of a textbox
Printer object is not available in Excel Vba.
You can copy the content of texbox to a cell in the sheet, and
print the content of the cell.
Ie:
http://www.excel-center.com/mailing/113000h.htm
and
http://www.excel-center.com/mailing/114800h.htm
or:
If you have a printer attached to Lpt1, you might try:
Private Sub cmdPrintDetails_Click()
Open "LPT1" For Output As #1
Print #1, TxtItemName.Text
Close #1
End Sub
# 2 Re: VBA: The code to Print content of a textbox
Btw:
To know if you can access an object thorugh your project, once
you are in Vba editor, press F2...