Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 127
Default Printing the contents of a text control on a user form

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Printing the contents of a text control on a user form

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 127
Default Printing the contents of a text control on a user form

Dear Tom:

Thank you for replying. However, when I try your code the "LPT1:" just goes
into a bit bucket somewhere, as I do not have anything connected to LPT1:,
but rather use a network printer.

Any other ideas? Thanks.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org


"Tom Ogilvy" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 127
Default Printing the contents of a text control on a user form

Never mind Tom. I did not read down far enough in your first reply. Thanks.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org


"Tom Ogilvy" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display contents of a cell in a user form text box -- Excel 2003 VBA hiskilini Excel Discussion (Misc queries) 7 April 4th 23 10:22 AM
Printing form & contents AB Excel Programming 10 July 20th 05 10:08 PM
Clear Contents Of A Text Box In User Form Graham[_5_] Excel Programming 1 April 22nd 04 09:09 AM
Submit User Form Contents to next available row jonathan Excel Programming 3 January 25th 04 07:17 PM
Control Order on User Form AKoodray Excel Programming 4 December 30th 03 09:30 PM


All times are GMT +1. The time now is 12:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"