Results 1 to 9 of 9
  1. #1
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    State of menu items (Excel 2000)

    In Word, a document can be saved with specific menu items disabled is one uses the command "CustomizationContext" = active document and the state of the menu items and key bindings travel with the document.

    My questions is there a way to do the same thing in Excel so that the state of menu items( enabled or disabled) travel with the workbook?

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: State of menu items (Excel 2000)

    You can put code into the Workbook Activate event routine to disable/remove the menu commands and code in the Workbook Deacivate event routine to replace/enable the commands.
    Legare Coleman

  3. #3
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: State of menu items (Excel 2000)

    Thanks. I forgot to explain that the code that is doing the enabling and disabling of the menu items is an addin not in the Excel workbook. if a workbook that had it's menu items disabled on a PC that has the addin is then sent to another PC that doesn not have te addin then it is desired that workbook is opned but because the addin that would enable the menu items is not on that PC then the menu items remains disabled.

  4. #4
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: State of menu items (Excel 2000)

    If I understand your question, I think you would have to create code in the workbook open event, to disable the items (and write code in the workbook close and windows deactivate event to enable them again)

    The problem is that many items are in multiple spots, some on right click menus, custom toolbars that it would be difficult to disable all of them. Even with the toolbar items disabled, they can still be accessed in VB.

    John Walkenbach's site has some code which demos some techniques for disabling items

    What are you trying to accomplish? There might be other ways to do it.
    Steve

  5. #5
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: State of menu items (Excel 2000)

    Unless the workbook has code to disable the items, if you are on a worksheet with your addin and the items are disabled, if the workbook (without the addin) is on another computer it won't need to enable them, since they would not be disabled.

    Steve

  6. #6
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: State of menu items (Excel 2000)

    Yeah that is what I was afraid, the menu items state does not travel with the workbook. In Word the state of the menus travel with the document if the customizeContent is set equal to the active document.

    We are trying to avoid having any macro code in the Workbook.

  7. #7
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: State of menu items (Excel 2000)

    As far as I know, you have to use code to do it (and would need code to put it back: very important to put back or you get irate users)

    Steve

  8. #8
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: State of menu items (Excel 2000)

    It is better to use Activate/Deactivate to do this. If you use Open/Close, then the menu items would be disabled for all open workbooks. They would not be reactivated when you switch to a different workbook.
    Legare Coleman

  9. #9
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: State of menu items (Excel 2000)

    You are correct, of course. Thought one thing wrote another.

    Thanks, Steve

Posting Permissions

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