Coding problem inserting text into text box

Derek

Well-known Member
Joined
Feb 16, 2002
Messages
1,592
Hi

Can anyone help me with this coding problem that has been driving me nuts.

I want to select a text box and insert text, as in this example which works well.
Selection.Characters.Text = "mytext"

However what I am trying to do is for it to accept the text in A1 of the activesheet. I have tried code like this without success:

Selection.Characters.Text = "mytext" & Range("A1").Value
Selection.Characters.Text = Range("A1").Value

Also tried to dim Range("A1").Value as a string or variant without success.

Please can someone explain to me the correct way of doing this.

Many thanks in advance

regards
Derek
 

Some videos you may like

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

SIXTH SENSE

Well-known Member
Joined
Oct 29, 2003
Messages
1,883
hi!
try this!
On design mode click properties and activate the textbox.
then look for the link cell and type A1.
anything you type in A1 will be refelcted in the textbox.
 

Derek

Well-known Member
Joined
Feb 16, 2002
Messages
1,592
Thanks Sixth Sense, I didn't think of that but how would I code that? My code opens a new text box, names it, then needs to insert whatever is in A1. After a bit of jiggerypoker it then deletes the text box.
After the initial load from A1, it doesn't need the link to A1 anymore. The advantage to me would be that I can easily change the text in A1 without having to change the code itself.

regards
Derek
 

SIXTH SENSE

Well-known Member
Joined
Oct 29, 2003
Messages
1,883
so you wan that be done in code

try this!

<font face=Courier New>TextBox1.LinkedCell = "A1"</FONT>

and to remove the link

<font face=Courier New>TextBox1.LinkedCell = ""</FONT>
 

Watch MrExcel Video

Forum statistics

Threads
1,111,910
Messages
5,541,541
Members
410,547
Latest member
htran4
Top