Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text box with more than 256 Characters

Status
Not open for further replies.

Horstt

Technical User
May 17, 2001
14
US
I am trying to paste a text box at the bottom of an Excel chart with a macro. If there are more that 256 characters nothing is showing up. I tried a label and am having the same problem. What Control can I use?

Here is my code:
Dim newTextBox As Shape

Set newTextBox = ActiveChart.Shapes.AddTextbox(msoTextOrientationHorizontal, 0, 375, 750, 28)

newTextBox.TextFrame.Characters.Text = "Special Cause Point Defintions : 1 pt beyond 3-sigma limit; 2 of 3 successive pts beyond 2-sigma limit; 4 of 5 successive pts beyond 1-sigma limit; 7 pts in a row on one side of the mean;" & _
'" 8 successive increasing or decreasing pts; 14 succesive alternating pts."
 
Horstt,

I am assuming that this is an embedded chart in a sheet. Can't insert textbox in a chart sheet.

Try using the Control Toolbox object...
Code:
Sub InsertTextbox()
    Dim newTextBox
     
    Set newTextBox = ActiveSheet.OLEObjects.Add(ClassType:="Forms.TextBox.1", Link:=False, _
            DisplayAsIcon:=False, Left:=0, Top:=375, Width:=750, Height:=28)
    
    With newTextBox.Object
        .Text = "Special Cause Point Defintions : 1 pt beyond 3-sigma limit;  " & _
            "2 of 3 successive pts beyond 2-sigma limit;  4 of 5 successive pts beyond 1-sigma limit; " & _
            "7 pts in a row on one side of the mean;  " & _
            "8 successive increasing or decreasing pts;  14 succesive alternating pts."
        .MultiLine = True
    End With
End Sub
Should work :)


Skip,
Skip@TheOfficeExperts.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top