Results 1 to 4 of 4

Thread: Excel Menu

  1. #1

    Thread Starter
    Member
    Join Date
    May 2003
    Posts
    50

    Question Excel Menu

    I'd like to create a new menu in an Excel Spread sheet. Now, I want it to be display ONLY with that specific spreadsheet. My customer already had an experience where a programmer put a new menu and it would come up every time he opened Excel.
    I have done very little Excel code and don't know how to write any (either that it stays or the one that opens with that specific spread sheet).
    Thanks

  2. #2
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    You can use the _Open and _BeforeClose events of the workbook to take the neccessary code.
    If this workbook is opened the _Open code will be run (Changing the Menu) and if it is closed the _BeforeClosed code is run.(Change to the normal menu)

    Note that another workbook might be already opened or be openened while yours is open, that might cause problems, as well as the double opening of your file (or a copy of that). But you can work around that.
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    The main problem is that the Menus and ComandBars are
    Global to Excel. You would need to create a class of events for
    each instance or workbooks opened. This would allow you to turn
    on and off the menus or commandbars if your workbook is not
    the active book. The _Deactivate event will not fire if there is
    another workbook getting the focus that is not in your event
    class. I havent herd or seen of anyone getting this working
    correctly.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Ok, I got it. I made it so when you open the workbook it add
    a new temporary menu "RobDog888" with some sub menus.
    Then if you create a new workbook from within
    the "MyEvents.xls" workbook, the "RobDog888" menu
    dissapears. Also, since it it a temporary menu, if you create a new
    workbook from outside of "MyEvents/xls" it will not have the new
    menu. You can build on it to include a toolbar or commandbar
    button or ???.

    Note: Macros must be set to medium so you can enable them to
    run or it wont work.
    Attached Files Attached Files
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

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



Click Here to Expand Forum to Full Width