text box reference

  • Thread starter Thread starter Caroline vincent
  • Start date Start date
C

Caroline vincent

Hello,

Instead of referencing my form text box to a cell on the
active sheet(see code below which works):
Private Sub UserForm_Activate()
TextBox1.Text = ActiveSheet.Range("ag11").Value
End Sub

I am trying to reference it to a text box on the sheet.
However, the following code does not work:
Private Sub UserForm_Activate()
TextBox1.Text = ActiveSheet.Shapes("Text Box 62").Text
End Sub

It gives me a run time error 438 (object does not support
thisproperty or method).

Any idea. Thanks
 
Private Sub UserForm_Activate()
TextBox1.Text = ActiveSheet.TextBoxes("Text Box 62").Text
End Sub

Text Box 62 would be consistent with a Textbox from the Drawing toolbar

demo the objects from the immediate window:
? activeSheet.Textboxes("Text Box 62").Text
This is my text
 
try this:
ActiveSheet.Shapes("Text Box 62").Select
TextBox1.Text = Selection.Text
 

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

Back
Top