Specify Multiple Toolbar Icons


Posted by JAF on July 13, 2000 7:12 AM

Further to my earlier post regarding "ghosting" custom toolbar icons when there was no active workbook (which I have now solved - thanks to Ryan for pointing me in the right direction), I now need to specify multiple toolbar icons to be either enabled or disabled.

Short of having one line of code for each toolbar icon (which I have at present) as follows:
Application.Toolbars("jaftest").ToolbarButtons(1).Enabled = True
Application.Toolbars("jaftest").ToolbarButtons(2).Enabled = True
Application.Toolbars("jaftest").ToolbarButtons(3).Enabled = True
etc.

Is it possible to specify multiple toolbar buttons in a single line of code?


JAF.



Posted by Ryan on July 13, 0100 10:52 AM

Jaf,

If the toolbars are in sequence(i.e. 1,2,3...), then you can loop the same line of code using:

For x = 1 to NumofButtons
Application.Toolbars("jaftest").ToolbarButtons(x).Enabled = True
Next x
This is an easy solution. Hope it helps.

Ryan