Permanently prevent User to see Formula Bar
Hola Kevin, thanks for your prompt response.
I tried your solution and it didn't hide any of the options in the View menu.
It did hide options in the Home, Insert, and Data menu options. The other
options remain open for the user to modify them.
This is what I entered:
Sub HideCBcontrols()
'
' Hide Formula Bar preventing user to activate it back
'
Dim CB As CommandBar, CBctrl As CommandBarControl
Dim CBnum As Integer, CBname As String
Dim CBctrlNum As Integer
CBnum = 1
CBctrlNum = 30004
On Error Resume Next
For Each CBctrl In Application.CommandBars.Item(CBnum).Controls
If CBctrl.ID = CBctrlNum Then
CBctrl.Visible = False
End If
Next
End Sub
Am I missing something?
OMER
"Kevin" wrote:
You could hide the View CommandBarControl in the Worksheet Main Menu. Use
the following code and set CBnum = 1 and CBctrl = 30004. Use the second set
of code to unhide it.
Hope this helps.
Sub HideCBcontrols()
Dim CB As CommandBar, CBctrl As CommandBarControl
Dim CBnum As Integer, CBname As String
Dim CBctrlNum As Integer
CBnum = InputBox("Enter CommandBar Index No.")
CBctrlNum = InputBox("Enter CommandBarCtrl ID No.")
On Error Resume Next
For Each CBctrl In Application.CommandBars.Item(CBnum).Controls
If CBctrl.ID = CBctrlNum Then
CBctrl.Visible = False
End If
Next
End Sub
Sub ShowCBcontrols()
Dim CB As CommandBar, CBctrl As CommandBarControl
Dim CBnum As Integer, CBname As String
Dim CBctrlNum As Integer
CBnum = InputBox("Enter CommandBar Index No.")
CBctrlNum = InputBox("Enter CommandBarCtrl ID No.")
On Error Resume Next
For Each CBctrl In Application.CommandBars.Item(CBnum).Controls
If CBctrl.ID = CBctrlNum Then
CBctrl.Visible = True
End If
Next
End Sub
"OMER" wrote:
Hola,
I wonder if there is a way to prevent (permanently) a user to activate the
formula bar while a specific worbook is open. I'm able to hide it inside the
openning macro with the following command:
Application.DisplayFormulaBar = False
However, the user can still go to the ribon menu and activate it back.
I want it top remain hidden until the workbook is closed.
Thank you for your help.
OMER
|