Texto en una textbox

rguez

Board Regular
Joined
Jul 24, 2002
Messages
78
Hola obra vez

Necesito llegar al texto dentro de una textbox
a través de un comando parecido al que sigue:


Ficha.Sheets("hoja1").Shapes("tbox25").Characters.Text = "mi texto"

El problema es que no funciona.

No me sirva la solucion: tbox25.text="mi texto"
pues el nombre de la textbox está en una variable que se recorre en un bucle.

Gracias
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hay que usar el objeto textframe primero.

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> WriteTextboxText()

    <SPAN style="color:#00007F">Dim</SPAN> strBoxName <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>
    <SPAN style="color:#00007F">Dim</SPAN> shpTextBox <SPAN style="color:#00007F">As</SPAN> Shape
    
    <SPAN style="color:#00007F">For</SPAN> i = 1 <SPAN style="color:#00007F">To</SPAN> 2
        strBoxName = "Text Box " & i
        <SPAN style="color:#00007F">Set</SPAN> shpTextBox = ActiveSheet.Shapes(strBoxName)
        shpTextBox.TextFrame.Characters.Text = "hello " & i
    <SPAN style="color:#00007F">Next</SPAN> i

    <SPAN style="color:#00007F">Set</SPAN> shpTextBox = <SPAN style="color:#00007F">Nothing</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>
 
Upvote 0

Forum statistics

Threads
1,223,944
Messages
6,175,553
Members
452,652
Latest member
eduedu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top