Worksheet Menu Bar

G

Gene

Opened an Excel 97 file with Excel 2000. Old file had an auto_open procedure which apparently hides the main worksheet commandbar. Now can't reopen this old file to read the code. It somehow became corrupted. Cannot get this commandbar to become visible with code 'Application.Commandbars(1).Visible = True'. Reinstalled Excel 2000 and commandbar still will not respond. Looped through entire commandbar collection and this bar appears at the top of the list. Anybody got any ideas
Thanks, Gene Walker
 
G

Gord Dibben

Gene

Try this in the Immediate Window

Application.CommandBars("Worksheet Menu Bar").Enabled = True

Gord Dibben Excel MVP
 
R

Rob van Gelder

I've always used CommandBars.ActiveMenuBar

Which is better?


--
Rob van Gelder - http://www.vangelder.co.nz/excel


Gord Dibben said:
Gene

Try this in the Immediate Window

Application.CommandBars("Worksheet Menu Bar").Enabled = True

Gord Dibben Excel MVP
procedure which apparently hides the main worksheet commandbar. Now can't
reopen this old file to read the code. It somehow became corrupted. Cannot
get this commandbar to become visible with code
'Application.Commandbars(1).Visible = True'. Reinstalled Excel 2000 and
commandbar still will not respond. Looped through entire commandbar
collection and this bar appears at the top of the list. Anybody got any
ideas?
 
B

Bob Phillips

Gene,

I think you have your answer in that it is the enabled property that you
want, not the visible property. FYI When you loop through the collection,
you can always test the name print out the index

For Each cb In Application.CommandBars
If cb.Name = "Worksheet Menu Bar" Then
Debug.Print cb.Index
Exit For
End If
Next cb

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Gene said:
Opened an Excel 97 file with Excel 2000. Old file had an auto_open
procedure which apparently hides the main worksheet commandbar. Now can't
reopen this old file to read the code. It somehow became corrupted. Cannot
get this commandbar to become visible with code
'Application.Commandbars(1).Visible = True'. Reinstalled Excel 2000 and
commandbar still will not respond. Looped through entire commandbar
collection and this bar appears at the top of the list. Anybody got any
ideas?
 
V

Vasant Nanavati

Hi Rob:

I would think the explicit solution is less ambiguous. For example, I
believe the ActiveMenuBar property returns the chart menu bar when a chart
is active.

Regards,

Vasant.
 
R

Rob van Gelder

You're correct about the menu when a Chart is active.

That in itself is reason enough for me to change.
 
Top