Disable sub items on a menu bar

  • Thread starter Thread starter Rhys Davies
  • Start date Start date
R

Rhys Davies

Hi - i disable all menu bars by default and then enable the 'file' menu bar
using the code:
CommandBars("Menu Bar").Controls("File").Visible = True

i then want to restrict what users can do with that menu - i.e i only want
them to be able to close a report and print a report, so i need to be able to
disable the remaining options. I can disable 'exit' with:

CommandBars("Menu Bar").Controls("File").Controls("Exit").Visible = False

however i cant get 'page setup' or 'print preview' to disable, does anyone
know how i should reference these 2 controls, an example of the 'page setup'
code is below.

CommandBars("Menu Bar").Controls("File").Controls("Page Setup").Visible =
False

I have tried removing the space between 'page' and 'setup' and entering an
underscore between them but that doesnt work either.

Does anyone know how to reference them?

Thanks,

Rhys.
 
Rhys said:
Hi - i disable all menu bars by default and then enable the 'file' menu bar
using the code:
CommandBars("Menu Bar").Controls("File").Visible = True

i then want to restrict what users can do with that menu - i.e i only want
them to be able to close a report and print a report, so i need to be able to
disable the remaining options. I can disable 'exit' with:

CommandBars("Menu Bar").Controls("File").Controls("Exit").Visible = False

however i cant get 'page setup' or 'print preview' to disable, does anyone
know how i should reference these 2 controls, an example of the 'page setup'
code is below.

CommandBars("Menu Bar").Controls("File").Controls("Page Setup").Visible =
False

I have tried removing the space between 'page' and 'setup' and entering an
underscore between them but that doesnt work either.


Try using the **exact** caption listed in the menu:

Controls("Page Setup...")
Controls("Print Preview")
 
Back
Top