Put text in Drawing Textbox without selecting it.

higrm

New Member
Joined
Nov 5, 2014
Messages
47
Please help. This kind of problem really frustrates me.

I'm trying to replace the commented out recorded code with a line that avoids selecting the textbox. But all my attempts at finding the correct syntax have failed with Error 438 "Object doesn't support this property or method". What is the correct syntax for these first two lines of commented out code?

Code:
'    Sheets("Instructions").Shapes("Textbox 1").Select
'    Selection.Characters.Text = Sheets("h1").Range("r14").Value
'On Error Resume Next

Sheets("Instructions").TextBox1.Text = "Some text"
Sheets("Instructions").TextBox("Textbox 1").Text = "Some text"
Sheets("Instructions").TextBox("Textbox 1").Value = "Some text"
Sheets("Instructions").TextBox("Textbox 1").TextFrame.Text = "Some text"
Sheets("Instructions").TextBox("Textbox 1").TextFrame2.Text = "Some text"
Sheets("Instructions").TextBox("Textbox 1").Characters.Text = "Some text"
Sheets("Instructions").Shapes("Textbox 1").Text = "Some text"
Sheets("Instructions").Shapes("Textbox 1").Value = "Some text"
Sheets("Instructions").Shapes("Textbox 1").TextFrame.Text = "Some text"
Sheets("Instructions").Shapes("Textbox 1").TextFrame2.Text = "Some text"

Using the Locals window, I can see that the parent of the selected textbox is sheet1, "Instructions". But I cannot find the right object to put the text into.
Thanks for your help,
Higrm
 
Last edited:

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
OK, not very intuitive, but this is what works:

Sheets("Instructions").Shapes("Textbox 1").OLEFormat.Object.Text = ".OLEFormat.Object.Text"

I cannot find a way to mark this thread as solved. Where is that button/option?
 
Last edited:
Upvote 0
Or, you can refer to the TextBoxes collection...

Code:
Sheets("Instructions").TextBoxes("TextBox 1").text = "Some text"

By the way, there's no way to close a thread on this Board, which is the way it should be. ;)
 
Upvote 0
Or, you can refer to the TextBoxes collection...

Code:
Sheets("Instructions").TextBoxes("TextBox 1").text = "Some text"

By the way, there's no way to close a thread on this Board, which is the way it should be. ;)


Thank you! That looks much prettier than the OLEFormat solution I finally found. I'll give that a try right away.

PS. Didn't want to close the thread, but I thought I remembered you could mark a thread as solved, so that people looking for solutions would know that something may be here.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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