Note this may be version specific; I'm on 2003. In 2003 View/Toolbar/Control Toolbox and drag command button to sheet to create a command button. Then in design mode, right click, and you see "properties" where you can, e.g. set an accelerator.
But if you use the code below (which is what macro recorder shows for what I just described, by the way) (and matchs Help example for Add method for OLEObjects), right clicking has no "properties", and the button is not as versatile - for example, I have been unable to set an accelerator. Can someone explain the difference? (BTW, browsing the watch window shows both are OLE type 2, but there are other property differences apparent from comparing in the watch window).
![]()
sub foo dim btn as OLEObject set btn=activesheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1") end sub
Bookmarks