Why do I get "object variable not set" when I run this?

Sub setobj()

Dim myobj As Object
Dim x As Integer
Set myobj = CommandBars.ActiveMenuBar
x = myobj.Controls.Count

End Sub