menu bars

A

anon

Firstly my apologies for lots of posts - I am polishing up a nearly
completed sheet and so have lots of niggles that I need help with.

I currently use cells on a sheet of my workbook which activate VBA (in
a similar way that buttons might). However I am thinking I could do
this a much neater way - by using custom menus (which i have never
done before).

However to make it user friendly I would like to get rid of all other
menu commands and just have one menu - my own - which alongised my
custom commands would have the save and close features.

Is this possible? If so how would I go about doing this (if anybody
can point me to some online sites to help a newbie on this i would
appreciate it)

What happens if somebody had 2 excel sheets open at once - would mine
have the custom menu bar and the other have the normal menu bar, or
would the custom bar apply to them both?
 
B

Bob Phillips

Option Explicit

Private mFormulaBar

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim oCB As CommandBar
For Each oCB In Application.CommandBars
oCB.Enabled = True
Next oCB

Application.DisplayFormulaBar = mFormulaBar
End Sub

Private Sub Workbook_Open()
Dim oCB As CommandBar
For Each oCB In Application.CommandBars
oCB.Enabled = False
Next oCB

mFormulaBar = Application.DisplayFormulaBar
Application.DisplayFormulaBar = False
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code



--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
A

anon

Thanks.

However this still creates a problem - users are likely to have more
than this one excel file open at once - and if they do then there are
no menu bars on their other files either. Is there a way round this?

Also this hides a customer menu bar - can I leave this visible? Is
there a way for a custom meu bar only to be visible in one excel file
(ie this one) and not in any others?
 
B

Bob Phillips

Put it in the Workbook_Activate and Workbook_Deactivate events instead of
Workbook_Open and Workbook_BeforeClose.

And Unhide your menu after all the rest were hidden.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
A

anon

One final question - if I now try to add std buttons to my custom
toolbar they are greyed out. Is this caused by this code and can I
change this?
 
A

anon

Ignore the above .... one day i'll learn not to post before trying
things out!

Thanks again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top