Thread: Toolbars
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_3_] Dick Kusleika[_3_] is offline
external usenet poster
 
Posts: 599
Default Toolbars

Randy

Something like this

Sub StoreCB()

Dim cb As CommandBar
Dim cbVis() As Boolean
Dim cbPos() As MsoBarPosition
Dim cbRw() As Long
Dim i As Long

ReDim cbVis(1 To Application.CommandBars.Count)
ReDim cbPos(1 To Application.CommandBars.Count)
ReDim cbRw(1 To Application.CommandBars.Count)

i = 1
For Each cb In Application.CommandBars
cbVis(i) = cb.Visible
cbPos(i) = cb.Position
cbRw(i) = cb.RowIndex
i = i + 1
Next cb

End Sub

Make those arrays module-level and use them to reset everything in another
sub.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Randal W. Hozeski" wrote in message
news:w5BIb.15195$I07.38816@attbi_s53...
Back in Excel 4.0 I used the following to take a snapshoot of what
toolbars where visible\active then remove them

SET.NAME("toolbarStatus",GET.TOOLBAR(9))
IF(NOT(ISERROR(toolbarStatus)))
FOR("barCount",1,COLUMNS(toolbarStatus))
SHOW.TOOLBAR(INDEX(toolbarStatus,1,barCount),FALSE )
NEXT()
END.IF()

Then to put them back I used:

IF(NOT(ISERROR(toolbarStatus)))
FOR("barCount",1,COLUMNS(toolbarStatus))
SHOW.TOOLBAR(INDEX(toolbarStatus,1,barCount),TRUE)
NEXT()
END.IF()

Looking for a VBA equivalent. -Randy-