Preston
Preston

Reputation: 8187

Add text to a text box Excel VBA

I can add text to a textbox using the following method:

ActiveSheet.Shapes.Range(Array("TextBox 6")).Select
Selection.Text = "a"

However selecting the shape seems like poor practice. I'd like to use something like:

Worksheets("Dashboard").Shapes("Textbox 6").Text = "a"

How is this achievable?

Upvotes: 1

Views: 15229

Answers (1)

cyboashu
cyboashu

Reputation: 10443

Use the TextFrame property

ActiveSheet.Shapes("Textbox 6").TextFrame.Characters.Text = "Hello"

Upvotes: 4

Related Questions