Object required (Error 424)

ACommandLineKindaGuy

Active Member
Joined
May 11, 2002
Messages
378
Office Version
  1. 365
Platform
  1. Windows
This is weird: I have 4 command buttons (CommandButton1 thru CommandButton4) and 1 text box (TextBox1).
I get a 424 Error whenever I try to set a TextBox1 property such as TextBox1.Left

I ran a short sub to grab all the shape names in the active worksheet:

For Each Sh In ActiveSheet.Shapes
MsgBox Sh.Name
Next Sh

and it returned Shape objects including the TextBox1 name.

But, I try and type something like TextBox1.Left and I get no dropdown after typing the period like I do when typing a period after CommandButton1.

I've checked spelling and made sure I used a 1 (number) and not an l (el letter)

Any ideas????

Tia John
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi,
Use one of these:
Rich (BB code):
Sub Test1()
  Dim Shp As Shape
  Set Shp = ActiveSheet.Shapes("TextBox1")
  MsgBox Shp.Left
End Sub
 
Sub Test2()
  Dim TBox As OLEObject
  Set TBox = ActiveSheet.OLEObjects("TextBox1")
  MsgBox TBox.Left
End Sub
Regards
 
Last edited:
Upvote 0
Thanks--yes, I did a permutation of that. So the problem is solved--but not very elegantly, and the underlying issue is still a mystery!!
 
Upvote 0
Is this more elegant?
Rich (BB code):
Sub Test3()
   Debug.Print Sheet1.TextBox1.Left
End Sub
where Sheet1 is the code name of the sheet
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,839
Members
449,051
Latest member
excelquestion515

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