Iterate Through All Buttons in a Toolbar



Your Ad Here

This simple example first gets the "Advanced" toolbar, and then iterates through all of the toolbar buttons in that toolbar.  It posts messages boxes with the names of the toolbar buttons.  You'll see things like "Setups", "UCS", "New Feature Wizard", "Snap Modes", "Toggle Geometry Bar", etc.  The name of the toolbar button is the same name that is printed as the tooltip in the Commands tab of the Customize Toolbars dialog.  See the screen grab below.

SNAG-0200.png (23235 bytes)

Option Explicit
Sub Main
	Dim bars As FMCmdBars
	Dim bar As FMCmdBar
	Dim controls As FMCmdBarCtrls
	Dim control As FMCmdBarCtrl

	Set bars = Application.CommandBars
	Set bar = bars("Advanced")
	Set controls = bar.Controls

	For Each control In controls
		MsgBox control
	Next
End Sub

 

Return to FeatureCAM Index


Your Ad Here