Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

excel menus 1

Status
Not open for further replies.

faxof

Programmer
Dec 5, 2001
272
GB
is there a way to stop users pulling down the File, Edit, Insert etc menus?

 
using VBA you can manipulate the menus. If you wanted to prevent the users from touching any of the main menus you could write some code similar to below in the Workbook Open even:
-------------------------------------
Dim cb As CommandBar
Dim cbControl As CommandBarControl

'Loop through all the commandbars
For Each cb In ThisWorkbook.Application.CommandBars
'Check to see if it's the main menu bar
If UCase(cb.Name) = "WORKSHEET MENU BAR" Then

'This section will gray out the main menu bar
'options.
For Each cbControl In cb.Controls
'MsgBox cbControl.Caption
cbControl.Enabled = False
Next
End If
Next
-------------------------------------
I'm sure there's a more efficient and less confusing way of accomplishing what you want, but I threw this together real quick so you'll at least have a base to go from and be able to tweak yourself.

Hope it helped
~K
 
worked like a treat - don't suppose you also know how to get rid of the name box and the formula bar do you?
 
no worries - i've worked it out now
With Application
.DisplayFormulaBar = False
End With
 
Today's lunchtime special - a more efficient way of doing this menu thang, that kshanes was sure existed!!!!!!!!

Dim con As CommandBarControl
For Each con In Application.CommandBars("worksheet menu bar").Controls
con.Enabled = False
Next

though the difference is probably negligable blah blah

one of those dys?!!

;-) If a man says something and there are no women there to hear him, is he still wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top