View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Gizmo Gizmo is offline
external usenet poster
 
Posts: 47
Default 2003 vba in 2007

I am using the following code in excel 2003. It works fine. When I try to use
the file in 2007 I get this error:
Run-time error '1004':
"Unable to get the Characters property of the TextBox class"

This code is highlighted in yellow:

txtBox1.Characters(Start:=startPos, _
Length:=Len(cell.Value)).Text = cell.Value & Chr(10)

Why does it work in 03 but not 07?

Here is more of the code:
I am using it to fill a textbox with data validation/help info

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$12" Then
txtBox1.Text = " "
Set theRange = Worksheets("Help").Range("B37:B41")
txtBox1.Visible = msoTrue
startPos = 1
For Each cell In theRange
txtBox1.Characters(Start:=startPos, _
Length:=Len(cell.Value)).Text = cell.Value & Chr(10)
startPos = startPos + Len(cell.Value) + 1
Next cell
Else
End If