Referring to Controls in a Command Bar

A CommandBar object contains Control objects, and these Control objects can contain other Control objects. When you choose FileOOpen, you're actually manipulating a Control (a menu item with a Caption of Open) that's contained in another Control (a menu with a Caption of File) that's contained in a CommandBar (the Worksheet menu bar).

Confused? Here's an example that may help clear things up. The following macro displays the Caption property for the first Control contained in the first Control of the first CommandBar object. When you execute this procedure, you see the message box shown in Figure 20-2.

0 0

Post a comment