#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default menu bars

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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default menu bars


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)

"anon" wrote in message
oups.com...
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?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default menu bars

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?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default menu bars

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)

"anon" wrote in message
ups.com...
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?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default menu bars

Bob

You're a genius! Thanks again for your help. This is perfect



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default menu bars

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?

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default menu bars

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

Thanks again

Reply
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Menu Bars Neil Hopkinson[_2_] Excel Programming 1 August 31st 05 10:02 PM
Lost all my menu bars and tool bars CathyJ Excel Discussion (Misc queries) 3 August 8th 05 12:49 PM
New Menu on Worksheet & Chart Menu Bars Juan[_3_] Excel Programming 2 May 21st 04 11:46 PM
linking chart menu bars and worksheet menu bars majikman[_8_] Excel Programming 0 May 10th 04 09:45 PM
menu bars majikman[_5_] Excel Programming 1 May 10th 04 09:05 AM


All times are GMT +1. The time now is 05:01 PM.

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

About Us

"It's about Microsoft Excel"