0

I am geting an error at this codeline:

BUTTON_PRESSED = 1 'example
var = CInt(Sheets("sheet1").TextBoxes("Title_" & BUTTON_PRESSED).Text)

im triying to get the content of the textbox named Title_1

what am i missing?

1 Answers1

0

You cannot access the text box on your sheet directly, but you can try through the Shapes collection.
Use the following:

var = CInt(Sheets("sheet1").Shapes("Title_" & BUTTON_PRESSED).DrawingObject.Text)

Make sure you have an integer value typed in this textbox.

Mrblackey
  • 94
  • 4
  • Almost!! CInt(Sheets("sheet1").Shapes("Title_" & BUTTON_PRESSED).DrawingObject.Text) not workd, but CInt(Sheets("sheet1").Shapes("Title_1").DrawingObject.Text) worked,.. BUTTON_PRESSED is a simple integer 1... dunno whats happening (sorry i dont know how to mini formating) – William Cezar Oct 15 '19 at 13:48
  • 1
    Weird... If nothing else prevents you from doing it, you can change the assignment to `BUTTON_PRESSED = "1"`. – Mrblackey Oct 15 '19 at 13:51