Thread: Run time error
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
UB UB is offline
external usenet poster
 
Posts: 120
Default Run time error

Hi
I have an Excell sheet that I send to diffrent users to complete a task. I
have a vba code on workbook open event to hide toolbars and menubar.
I code is :
Application.CommandBars("Worksheet Menu Bar").Enabled = False
Application.OnKey "%-"
Application.CommandBars("Standard").Visible = False
Application.CommandBars("Formatting").Visible = False
Application.CommandBars("PROMT SmarTool").Visible = False
Application.CommandBars("Control Toolbox").Visible = False

But I am getting an error , because I don't know, what type of commandbars
are open at the user level. If I take this code out from the workbook open
event, my sheet runs perfect.
Can some advise, a better way to write vba code to make all commandbars and
menubar items invisible on workbook open and make them visible on workbook
close

Thanks in advance