LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default Do Until ??

Used info from J. Walks Dummies Excel VBA Programming.
Open workbook: Remove "standard" toolbars
Close WorkBook Re-Install the "standard" toolbars.
That works Great.
Then I tried to add Install my special toolbars under
Open Work Book and things went nuts.
My combined process, as shown below is obviously flawed.
The install special toolbars should not occur til the "standard" toolbar
removal process is completed and stops executing.
I expect that "do until" would work OK, but I don't now how to build
that in.
OR, If there is an easier, or more efficient way, thats find too.

I don't expect a problem with the closing sequence.

Option Explicit
Private Sub Workbook_Open()
Dim TBarCount As Integer
Dim cbar As CommandBar
Sheets("Sheet1").Range("A:A").ClearContents
TBarCount = 0
For Each cbar In Application.CommandBars
If cbar.Type = msoBarTypeNormal Then
If cbar.Visible Then
TBarCount = TBarCount + 1
Sheets("Sheet1").Cells(TBarCount, 1) = _
cbar.Name
cbar.Visible = False
End If
End If
Next cbar

Application.CommandBars("JFS-C1").Visible = True
Application.CommandBars("JFS-C2").Visible = True
Application.CommandBars("JFS-C3").Visible = True
Application.CommandBars("Protection").Visible = True
Application.CommandBars("JFS-Comments").Visible = True
Application.CommandBars("JFS-Macros").Visible = True
Application.CommandBars("JFS-Private").Visible = True

End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next

Application.CommandBars("JFS-C1").Delete
Application.CommandBars("JFS-C2").Delete
Application.CommandBars("JFS-C3").Delete
Application.CommandBars("Protection").Delete
Application.CommandBars("JFS-Comments").Delete
Application.CommandBars("JFS-Macros").Delete
Application.CommandBars("JFS-Private").Delete

Dim Row As Long
Dim TBar As String
Row = 1
TBar = Sheets("Sheet1").Cells(Row, 1)
Do While TBar < ""
Application.CommandBars(TBar).Visible = True
Row = Row + 1
TBar = Sheets("Sheet1").Cells(Row, 1)
Loop
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"