LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 178
Default Protecting menu in a workbook or sheet

Les,
Which menu are you looking at?
Which version of Excel are you using?

--
HTH,
Gary Brown

If this post was helpful to you, please select ''YES'' at the bottom of the
post.



"Les" wrote:

Hi Gary,

Listen I entered your code into my app but it didnt disable the Hide and
Unhide commands in the menu. I did a trace on the VB side and it does go
into the module and says it disables the 2 features but when I run the app I
am still able to hide and unhide rows ??? Do you or anyone out here know
why that is so ??

Look forward to hearing from you,

Thanks,

Les
"Gary Brown" wrote in
message ...
Option Explicit

'/======================================/
Public Sub DisableMenuItem_Example()
'Disable / enable a menu item such as Sort, Data, etc
' - used when you don't want to let a user , for example,
' sort on their own
'05/31/2005
'
Dim objMenuItem As Object
Dim strHide As String, strUnhide As String

'- - - - - - VARIABLES - - - - - - - - -
strHide = "&Hide" 'item #1 to find
strUnhide = "&Unhide" 'item #1 to find
'- - - - - - - - - - - - - - - - - - - -

For Each objMenuItem In CommandBars("ROW").Controls
If objMenuItem.Caption = strHide Or _
objMenuItem.Caption = strUnhide Then
objMenuItem.Enabled = False 'disable a menu item
Exit For
End If
Next objMenuItem

End Sub
'/======================================/
Public Sub EnableMenuItem_Example()
'Disable / enable a menu item such as Sort, Data, etc
' - used when you don't want to let a user , for example,
' sort on their own
'05/31/2005
'
Dim objMenuItem As Object
Dim strHide As String, strUnhide As String

'- - - - - - VARIABLES - - - - - - - - -
strHide = "&Hide" 'item #1 to find
strUnhide = "&Unhide" 'item #1 to find
'- - - - - - - - - - - - - - - - - - - -

For Each objMenuItem In CommandBars("ROW").Controls
If objMenuItem.Caption = strHide Or _
objMenuItem.Caption = strUnhide Then
objMenuItem.Enabled = True 'enable a menu item
Exit For
End If
Next objMenuItem

End Sub
'/======================================/

To disable/enable columns change "ROW" to "COLUMN".

--
HTH,
Gary Brown

If this post was helpful to you, please select ''YES'' at the bottom of

the
post.



"Les" wrote:

I have a workbook with 3 sheets in it. After the application runs it

hides
a bunch of data on sheet1 and only displays the data on that sheet for a
particular enduser. What I want to disable is the Hide and unhide rows
feature for one. Is there an easy way of doing that and still not have

to
worry about what happens initially when the macro runs?? Are there

features
witin excel that allows to me shut off parts of the menu??

Hopefully I made myself clear as to what I am trying to acomplish and if

not
let me know and I will see if I can phrase it differently.

Thanks in advance,

Les






 
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
protecting formulas without protecting sheet so grouping still wor JM Excel Discussion (Misc queries) 1 June 4th 09 06:42 AM
protecting workbook jolowe Excel Discussion (Misc queries) 2 June 8th 08 02:57 PM
Protecting Sheet vs. Workbook Skydiver Excel Discussion (Misc queries) 4 October 29th 06 06:05 PM
password protecting sheet when workbook opens mercer77 Excel Programming 2 February 13th 06 12:44 PM
protecting a sheet in a different workbook Dan Winterton Excel Programming 2 January 25th 05 06:49 PM


All times are GMT +1. The time now is 08:09 AM.

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"