ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   2003 vba in 2007 (https://www.excelbanter.com/excel-discussion-misc-queries/194960-2003-vba-2007-a.html)

Gizmo

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


All times are GMT +1. The time now is 07:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com