Disable sub items on a menu bar

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.
 
M

Marshall Barton

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")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top