Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Text and TextBox problem

With a textbox from the Drawing toolbar, how do I
programmatically load the textbox with loads of text?

ActiveSheet.Shapes("Text Box 10").Visible = True
ActiveSheet.Shapes("Text Box 10").Select
' Selection.Text = "ABC" 'this works
'the following does not work
Selection.Text = _
"Use this Fax template to create the first Fax for a new" & _
vbNewLine & "Contract." & vbNewLine & vbNewLine _
& "Enter all those items that will be 'standard' for every Fax."

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.726 / Virus Database: 481 - Release Date: 22/07/2004


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Text and TextBox problem

Stuart,

Try something like the following:

Dim SH As Shape
Set SH = ActiveSheet.Shapes("Text Box 1")
SH.TextFrame.Characters.Text = "this is some text" & vbLf & _
"this is some more text"



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Stuart" wrote in message
...
With a textbox from the Drawing toolbar, how do I
programmatically load the textbox with loads of text?

ActiveSheet.Shapes("Text Box 10").Visible = True
ActiveSheet.Shapes("Text Box 10").Select
' Selection.Text = "ABC" 'this works
'the following does not work
Selection.Text = _
"Use this Fax template to create the first Fax for a new" &

_
vbNewLine & "Contract." & vbNewLine & vbNewLine _
& "Enter all those items that will be 'standard' for every

Fax."

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.726 / Virus Database: 481 - Release Date:

22/07/2004




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Text and TextBox problem

Suggested is that you use vbLf instead of vbNewLine and
otherwise let the textbox automatically wrap the text.
Note that you don't need to select the textbox.

Sub LoadText()
Dim Msg As String
Msg = "INSTRCTIONS:" & vbLf & "Use this Fax template " & _
"to create the first Fax for a new Contract. Enter " & _
"those items that will be 'standard' for every Fax."
With ActiveSheet.Shapes("Text Box 10")
.Visible = True
.TextFrame.Characters.Text = Msg
End With
End Sub

Regards,
Greg


-----Original Message-----
With a textbox from the Drawing toolbar, how do I
programmatically load the textbox with loads of text?

ActiveSheet.Shapes("Text Box 10").Visible = True
ActiveSheet.Shapes("Text Box 10").Select
' Selection.Text = "ABC" 'this works
'the following does not work
Selection.Text = _
"Use this Fax template to create the first Fax for a

new" & _
vbNewLine & "Contract." & vbNewLine & vbNewLine _
& "Enter all those items that will be 'standard' for

every Fax."

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.726 / Virus Database: 481 - Release Date:

22/07/2004


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Text and TextBox problem

Many thanks to you both.

Regards.

"Chip Pearson" wrote in message
...
Stuart,

Try something like the following:

Dim SH As Shape
Set SH = ActiveSheet.Shapes("Text Box 1")
SH.TextFrame.Characters.Text = "this is some text" & vbLf & _
"this is some more text"



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Stuart" wrote in message
...
With a textbox from the Drawing toolbar, how do I
programmatically load the textbox with loads of text?

ActiveSheet.Shapes("Text Box 10").Visible = True
ActiveSheet.Shapes("Text Box 10").Select
' Selection.Text = "ABC" 'this works
'the following does not work
Selection.Text = _
"Use this Fax template to create the first Fax for a new" &

_
vbNewLine & "Contract." & vbNewLine & vbNewLine _
& "Enter all those items that will be 'standard' for every

Fax."

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.726 / Virus Database: 481 - Release Date:

22/07/2004






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.726 / Virus Database: 481 - Release Date: 23/07/2004


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
Problem with TAB key and Textbox controls Paul M[_4_] Excel Programming 2 June 6th 14 05:54 PM
Excel VBA TextBox problem excelnoob Excel Programming 0 June 30th 04 11:54 AM
Textbox problem Robert Couchman[_4_] Excel Programming 11 February 26th 04 02:01 PM
Problem with TextBox & ControlSource - Please Help [email protected] Excel Programming 8 January 14th 04 06:45 AM
Excel textbox problem numcrun Excel Programming 0 July 16th 03 10:05 AM


All times are GMT +1. The time now is 08:39 AM.

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

About Us

"It's about Microsoft Excel"