text does not update in rectangle box

M

matelot

Hi,
I want to be able to update the text in the rectangle when the user clicks
on it. My code doesn't seem to update the text even though under debugging
mode, I can see it updating.
Pls help.

ActiveSheet.Shapes("Rectangle 2").Select
Selection.Characters.Text = "test1 "
MsgBox "ts"
ActiveSheet.Shapes("Rectangle 2").Select
Selection.Characters.Text = "test2 "
ActiveCell.Select
 
V

Vergel Adriano

Hi,

Try it like this:

ActiveSheet.Shapes("Rectangle 1").OLEFormat.Object.Caption="TEST"
 
C

Corey

Try something like:

Sub ChangetheTextintheShape()
Dim res As String
With Selection
res = InputBox("What text do you want placed in the Shape?")
Selection.Characters.Text = res
End With
End Sub


Hi,
I want to be able to update the text in the rectangle when the user clicks
on it. My code doesn't seem to update the text even though under debugging
mode, I can see it updating.
Pls help.

ActiveSheet.Shapes("Rectangle 2").Select
Selection.Characters.Text = "test1 "
MsgBox "ts"
ActiveSheet.Shapes("Rectangle 2").Select
Selection.Characters.Text = "test2 "
ActiveCell.Select
 
C

Corey

Or

Sub ChangetheTextintheShape()
Dim res As String
With ActiveSheet.Shapes("Rectangle 2")
res = InputBox("What text do you want placed in the Shape?")
Selection.Characters.Text = res
End With
End Sub


Will only work with Rectangle 2, but you would need to place a button on the sheet to run it.

Corey....

Try something like:

Sub ChangetheTextintheShape()
Dim res As String
With Selection
res = InputBox("What text do you want placed in the Shape?")
Selection.Characters.Text = res
End With
End Sub


Hi,
I want to be able to update the text in the rectangle when the user clicks
on it. My code doesn't seem to update the text even though under debugging
mode, I can see it updating.
Pls help.

ActiveSheet.Shapes("Rectangle 2").Select
Selection.Characters.Text = "test1 "
MsgBox "ts"
ActiveSheet.Shapes("Rectangle 2").Select
Selection.Characters.Text = "test2 "
ActiveCell.Select
 

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