Page 396 - Microsoft Office Excel 2003 Programming Inside Out
P. 396
Part 5: Manipulating Excel Objects
Microsoft Office Excel 2003 Programming Inside Out
Adding a Floating Command Bar
You can add a floating command bar (shown in Figure 17-3) to Excel with the following
routine. Notice that the Add method uses the name Excel2k3 VBA, which has embedded
spaces. The msoBarFloating value specifies that the bar should not be docked with the other
command bars, but instead should be displayed in a separate window that can be moved
around by the user.
Sub FloatingCommandBar()
Dim c As CommandBar
Set c = Application.CommandBars.Add("Excel2k3 VBA", _
msoBarFloating, False, True)
c.Enabled = True
c.Visible = True
End Sub
Figure 17-3. A floating command bar is not docked with the other command bars.
Setting the third parameter of the Add method to False means that the command bar will
Chapter 17
simply be added to the collection. A value of True means that this bar will replace the stan
dard menu bar in the Excel application.
370