from an Old post:
Sub Macro5()
Dim ctrl as Long
Dim tmpstr as String
Open "LPT1:" For Output As #1
Print #1, "[Start of Printing Test]"
For ctrl = 1 To 10
tmpstr = "Printing ine " + Str(ctrl)
Print #1, tmpstr
Next
tmpstr = "[End of printing test]" + Chr(12)
Print #1, tmpstr
Close #1
End Sub
To a Network printer
First, I went to the immediate window in the VBE to query the activeprinter
string
? activePrinter
\\ARDAPS01\1D343E on Ne02:
then I used the first part in the below code:
Sub Macro5()
Dim ctrl As Long
Dim tmpstr As String
Open "\\ARDAPS01\1D343E" For Output As #1
Print #1, "[Start of Printing Test]"
For ctrl = 1 To 10
tmpstr = "Printing Line " + Str(ctrl)
Print #1, tmpstr
Next
tmpstr = "[End of printing test]" + Chr(12)
Print #1, tmpstr
Close #1
End Sub
Worked for me.
Regards,
Tom Ogilvy
------------------------------------
So modify the code above to use the textstring in your text box
tmpstr = textbox2.Text
as an example.
--
Regards,
Tom Ogilvy
"Chaplain Doug" wrote:
Excel 2003. I have a user form called "ProcessStatus" that has a text box
called "ProcStat" which is populated with information as a process completes.
I have placed a "Print" button control on the form that I want to use to
print the contents of the text box. What code would I use to print the text
box contents?
ProcessStatus.Print does not work as it prints the whole form. The text box
has a verical scroll and thus all text is not printed.
Thanks for any help you may give. God bless.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org