Hide Menu and tool bars

gjadcock

New Member
Joined
Sep 17, 2002
Messages
27
What VB code do I need to turn off menu bars and tool bars so the user just sees the top title bar when opening the file. Also is there any way to prevent the user selecting any cells on the front page, I want to ensure the only selectable field on the sheet is a Text box used for searching.

Thanks in advance

Graham
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
For hiding the Toolbars see:

http://www.ozgrid.com/VBA/ExcelWorkbookEvents.htm

For your second question right click the sheet tab and choose View Code. In the Properties window (press F4 if you can't see it) set the EnableSelection property to -4142 - xlNoSelection. Press Alt+F11 to return to your worksheet. The worksheet must be protected for the property to take effect.
 
Upvote 0
Thanks Andrew, One problem the EnableSelection property seems to be re-setting itself to NoRestriction when I re open the file, any ideas??

Yes, I have un-protected the sheet, made the changes, protect the sheet and resaved before closing and re-opening to test.
 
Upvote 0
You can set it again in the Workbook_Open event procedure, eg:

Code:
Private Sub Workbook_Open()
With Worksheets(1)
    .EnableSelection = xlNoSelection
End With
End Sub
 
Upvote 0
Excellent, works fine now Thanks.

Just one more thing, on the sheet I have a textbox, is there anyway to have the text box selected (waiting for input, cursor flashing etc) the instant the user opens the file. At the moment someting is selected but you can't see it, if I type in anything I get the worksheet is protected message, which I would expect if I had physically selected a cell.
 
Upvote 0
Andrew, Have sussed it using:

ActiveSheet.bldg_code_entry.Activate under Workbook_open

Thanks for your help on the other questions
 
Upvote 0

Forum statistics

Threads
1,214,545
Messages
6,120,132
Members
448,947
Latest member
test111

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top