Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 355
Default Print contents of textbox (has scrollbars)

Hello -

I have a worksheet that includes a textbox. I need to be able to print the
entire contents of it. (It is a fixed size and uses scrollbars to display
all of the text.)

Is there some way I can code the printing of the document to do this?

Any suggestions will be greatly appreciated!
--
Sandy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Print contents of textbox (has scrollbars)

so it shows all the text just by printing it and not resizing the textbox
(text remains hidden in the box)? No.

moving the text somewhere else in a properly sized area or resizing the
textbox and then printing all the visible text? yes, you should be able to
write code to do that.

--
Regards,
Tom Ogilvy


"Sandy" wrote in message
...
Hello -

I have a worksheet that includes a textbox. I need to be able to print

the
entire contents of it. (It is a fixed size and uses scrollbars to display
all of the text.)

Is there some way I can code the printing of the document to do this?

Any suggestions will be greatly appreciated!
--
Sandy



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Print contents of textbox (has scrollbars)

Here is a quick way that might help. (Tested on Win98 and Excel97.)
Calling this sub will just print the textbox contents. Note the changes
that you have to make if not using TextBox1 on Sheet1, and also the path
to notepad.exe if not c:\windows. You can make it run when printing the
worksheet by calling this sub in the Workbook_BeforePrint event (or
putting the code there). A bit crude, but it works. As Tom O. says,
there are other (longer) ways to put the text into a printable format on
a worksheet.

Sub PrintTextBox()
Dim intOutFile As Integer 'number for the output file

intOutFile = FreeFile 'get a file number

'change path and file name if required.
Open "c:\temp\temp.txt" For Output As intOutFile
'Change next line to use your text box. Could also pass a
'textbox object to this sub.
Print #intOutFile, Sheet1.TextBox1.Text
Close intOutFile

'Open notepad and print the file. Adjust the path to notepad.exe
'as required. This will print to the default printer without
'any dialog box.
Shell "c:\windows\notepad.exe /P c:\temp\temp.txt"

Kill "c:\temp\temp.txt" 'delete the file if desired
End Sub

Sandy wrote:
Hello -

I have a worksheet that includes a textbox. I need to be able to print the
entire contents of it. (It is a fixed size and uses scrollbars to display
all of the text.)

Is there some way I can code the printing of the document to do this?

Any suggestions will be greatly appreciated!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Print contents of textbox (has scrollbars)


LebB,

Brilliant!

Davi

--
david
-----------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...fo&userid=2064
View this thread: http://www.excelforum.com/showthread.php?threadid=49627

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 355
Default Print contents of textbox (has scrollbars)

Thanks, Len!
--
Sandy


"LenB" wrote:

Here is a quick way that might help. (Tested on Win98 and Excel97.)
Calling this sub will just print the textbox contents. Note the changes
that you have to make if not using TextBox1 on Sheet1, and also the path
to notepad.exe if not c:\windows. You can make it run when printing the
worksheet by calling this sub in the Workbook_BeforePrint event (or
putting the code there). A bit crude, but it works. As Tom O. says,
there are other (longer) ways to put the text into a printable format on
a worksheet.

Sub PrintTextBox()
Dim intOutFile As Integer 'number for the output file

intOutFile = FreeFile 'get a file number

'change path and file name if required.
Open "c:\temp\temp.txt" For Output As intOutFile
'Change next line to use your text box. Could also pass a
'textbox object to this sub.
Print #intOutFile, Sheet1.TextBox1.Text
Close intOutFile

'Open notepad and print the file. Adjust the path to notepad.exe
'as required. This will print to the default printer without
'any dialog box.
Shell "c:\windows\notepad.exe /P c:\temp\temp.txt"

Kill "c:\temp\temp.txt" 'delete the file if desired
End Sub

Sandy wrote:
Hello -

I have a worksheet that includes a textbox. I need to be able to print the
entire contents of it. (It is a fixed size and uses scrollbars to display
all of the text.)

Is there some way I can code the printing of the document to do this?

Any suggestions will be greatly appreciated!




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Print contents of textbox (has scrollbars)

davidm wrote:
LebB,

Brilliant!

David


Thanks! I'll take that kind of feedback anytime.
Len
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 181
Default Print contents of textbox (has scrollbars)

Great tip... I was looking for it... glad I found it on an old posts... it is
always good to dig into already posted questions.

"LenB" wrote:

Here is a quick way that might help. (Tested on Win98 and Excel97.)
Calling this sub will just print the textbox contents. Note the changes
that you have to make if not using TextBox1 on Sheet1, and also the path
to notepad.exe if not c:\windows. You can make it run when printing the
worksheet by calling this sub in the Workbook_BeforePrint event (or
putting the code there). A bit crude, but it works. As Tom O. says,
there are other (longer) ways to put the text into a printable format on
a worksheet.

Sub PrintTextBox()
Dim intOutFile As Integer 'number for the output file

intOutFile = FreeFile 'get a file number

'change path and file name if required.
Open "c:\temp\temp.txt" For Output As intOutFile
'Change next line to use your text box. Could also pass a
'textbox object to this sub.
Print #intOutFile, Sheet1.TextBox1.Text
Close intOutFile

'Open notepad and print the file. Adjust the path to notepad.exe
'as required. This will print to the default printer without
'any dialog box.
Shell "c:\windows\notepad.exe /P c:\temp\temp.txt"

Kill "c:\temp\temp.txt" 'delete the file if desired
End Sub

Sandy wrote:
Hello -

I have a worksheet that includes a textbox. I need to be able to print the
entire contents of it. (It is a fixed size and uses scrollbars to display
all of the text.)

Is there some way I can code the printing of the document to do this?

Any suggestions will be greatly appreciated!


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
How To Print the contents of a TextBox DMS Excel Programming 1 September 30th 05 11:13 PM
textbox scrollbars disappear Yaniv Excel Programming 3 July 27th 05 01:24 PM
Contents of a TextBox to HTML [email protected] Excel Programming 0 January 27th 05 06:40 PM
How do I print the contents of a textbox that is on a Userform DMS Excel Programming 1 January 7th 05 12:00 AM
Copy textbox contents Stuart[_5_] Excel Programming 2 August 15th 04 06:57 PM


All times are GMT +1. The time now is 07:14 AM.

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"