excelvbaactivexobject

Select text in ActiveX Text Box using Excel VBA


I am trying to select the text in an ActiveX Text Box, so I can manipulate it via the keyboard.

I want a command that would work similarly to:

ActiveSheet.Shapes("Shape Name").TextFrame2.TextRange.Select

However, the code reference required is OLEObjects since I am using an ActiveX Text Box.

I could change the text with something like:

ActiveSheet.OLEObjects("Shape Name").Object.Text = "Text"

But I want to select the text so I can type into it with my keyboard.


Solution

  • Try this:

    ActiveSheet.OLEObjects("Shape Name").Activate