2003 vba in 2007

G

Gizmo

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top