Archive of Mr Excel Message Board


Back to Excel VBA archive index
Back to archive home

"new" and "open" buttons on the standard menu

Posted by Jim on December 11, 2001 3:25 PM
Hi,
Could someone please show me how to delete or disable
these buttons, "New" & "Open".The actual buttons not
"New" and "Open" in the dropdown menu.
Thanks, Jim

Check out our Excel VBA Resources

Re: "new" and "open" buttons on the standard menu

Posted by Jacob on December 11, 2001 3:42 PM
Just use part of the code I previously posted

Private Sub Workbook_Activate()
Dim MyCommand As CommandBar
Set MyCommand = Application.CommandBars("Standard")

With MyCommand
.Controls("&New").Enabled = False
.Controls("&Open").Enabled = False


End With

End Sub


Private Sub Workbook_Deactivate()
Dim MyCommand As CommandBar
Set MyCommand = Application.CommandBars("Standard")

With MyCommand
.Controls("&New").Enabled = True
.Controls("&Open").Enabled = True


End With

End Sub


This will stop people from being able to use the open or new buttons on the command bar, but they can still use hot keys or the file menu.

Hope this helps

Jacob


Thanks, Jacob it's working now!(nt)

Posted by Jim on December 11, 2001 4:03 PM


This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.