Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
davidm wrote:
LebB, Brilliant! David Thanks! I'll take that kind of feedback anytime. Len |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How To Print the contents of a TextBox | Excel Programming | |||
textbox scrollbars disappear | Excel Programming | |||
Contents of a TextBox to HTML | Excel Programming | |||
How do I print the contents of a textbox that is on a Userform | Excel Programming | |||
Copy textbox contents | Excel Programming |