Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Greying out Menus (Office 97 SR2)

    I have resumed an old task which I was working on, and have now remembered why I stopped working on it.
    I am trying to find out how to grey "paste" from the top menu so it cannot be selected. I'm not 100% sure if this can be done, but i'm sure i've seen similar posts here before.
    If anyone can point me in the direction of one of those posts or to where I can find out how to do this, it'd be much appreciated.

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Greying out Menus (Office 97 SR2)

    Phil,

    So far i know you can't grey something in a built-in commandbar.
    You have to create your own commandbar.(Access 97 Wizard: Command Bar Wizard available at <A target="_blank" HREF=http://office.microsoft.com/downloads/9798/wzcmbr80.aspx>http://office.microsoft.com/download.../wzcmbr80.aspx</A>)
    When you have your own commandbar.
    In the form property Other | Menu bar type the name of your commandbar.
    Now you can grey what you want with this code:

    Dim cb As CommandBar
    Dim cb2 As CommandBarPopup
    Set cb = CommandBars("YourCommandBar)
    Set cb2 = cb.Controls.Item(2) ' 2 is for Edit, second item in the commandbar
    cb2.Controls.Item(4).Enabled = False ' 4 is for Past, forth item in the Edit Popup

    Francois
    Francois

  3. #3
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Greying out Menus (Office 97 SR2)

    Thanks for your reply Francois,
    However, one of the older posts refered to an article on MSDN which I couldn't find, however, through a similar article under Access 97technical articles in the library I found the following line works:

    CommandBars("edit").Controls("paste").Enabled = False

    Where I was having trouble was that I didn't know about the following section:

    Quote from MSDN "Click References on the Tools menu while in module Design view, and select the check box next to Microsoft Office 8.0 Object Library."

    I will, however, look into the code you provided, as any info is welcome.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Greying out Menus (Office 97 SR2)

    As Francois indicated, it is much simpler to create and manipulate your own commandbars while leaving the default commandbars intact. That also leaves you the option of bypassing the startup when you're developing and having access to both the built-in and the custom commandbars, while restricting those that your users can see.

    In fact, if you plan to distribute a runtime version of your database, you *must* create custom commandbars and build code to make them work, because the built-in commandbar functions don't necessarily work in the runtime.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •