+ Reply to Thread
Results 1 to 14 of 14

Losing a custom menu bar within Windows menu bar when new excel session is opened.

  1. #1
    Registered User
    Join Date
    10-04-2014
    Location
    Sydney, Australia
    MS-Off Ver
    2003
    Posts
    18

    Losing a custom menu bar within Windows menu bar when new excel session is opened.

    Hi Team,

    I have a few different Custom Menus that I have created for various macro functions in various workbooks. Whenever I restart the computer and launch excel, sometimes one of the menus is still there and the others have dropped off. So I am having to re-create these menus over and again. Which is painful as one of the menus has more than 20 different macro functions.

    Is there a simple function or a macro that I would need to keep the menus from disappearing?

    Thanks in advance.
    Steve
    Last edited by SCACCHIA; 11-17-2014 at 03:41 PM. Reason: The Macro's herein solved my issue. Thx...

  2. #2
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Losing a custom menu bar within Windows menu bar when new excel session is opened.

    Here's how I have done it. Place the following in the ThisWorkbook code module of the workbook where the specific menu item(s) is/are needed. They will then appear when you are in that workbook, and go away when you leave it. Substitute the menu names, items, and subroutine names with your own.

    Please Login or Register  to view this content.
    If you have code already in that workbook that opens or activates other workbooks, then additional measures may be needed to avoid triggering this code while that is happening. It's not essential, but it might be desirable, especially if you work in the debugger much.
    Acts 4:12
    Salvation is found in no one else, for there is no other name under heaven given to mankind by which we must be saved.

  3. #3
    Registered User
    Join Date
    10-04-2014
    Location
    Sydney, Australia
    MS-Off Ver
    2003
    Posts
    18

    Re: Losing a custom menu bar within Windows menu bar when new excel session is opened.

    Hi thanks for the above, no I don't have code that opens or activates other workbooks. I tried the above code in a new workbook to see what it looks like when activated, upon selecting Create Menu, I got a VBA message which read "Compile error: Variable not defined" with that it had (MenuObject =) high lighted just next to the set function, can you please review and advise. Thanks again.

    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Losing a custom menu bar within Windows menu bar when new excel session is opened.

    Probably because you don't have the subroutines defined that it's trying to assign.

  5. #5
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Losing a custom menu bar within Windows menu bar when new excel session is opened.

    Oh, my mistake. Please revise the top line as follows:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    10-04-2014
    Location
    Sydney, Australia
    MS-Off Ver
    2003
    Posts
    18

    Re: Losing a custom menu bar within Windows menu bar when new excel session is opened.

    Thank you, that worked nicely. Now with the Subroutines, do I just overtype this with the Macro Name as created in VB?

  7. #7
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Losing a custom menu bar within Windows menu bar when new excel session is opened.

    Yup. Replace Item11Subroutine with your name, etc.

  8. #8
    Registered User
    Join Date
    10-04-2014
    Location
    Sydney, Australia
    MS-Off Ver
    2003
    Posts
    18

    Re: Losing a custom menu bar within Windows menu bar when new excel session is opened.

    Excellent, this works brilliantly. One last question. Can I add Sub menus inside the main menu that have subroutines attached therein. For instance a Sub menu, might be called "KITS" and the subroutines therein would be called "QPH01KIT", "QPH02KIT" and so on?

    I have attached a picture file, as you can see this is how my current menu looks, as you can see it has 2 x Sub Menus then the Macro links to run the Kits. Just wondering if this can be coded?

    Sub Menu Lists.png

    Thanks again,
    Steve
    Last edited by SCACCHIA; 11-12-2014 at 08:54 PM.

  9. #9
    Registered User
    Join Date
    10-04-2014
    Location
    Sydney, Australia
    MS-Off Ver
    2003
    Posts
    18

    Smile Re: Losing a custom menu bar within Windows menu bar when new excel session is opened.

    Hi There again, I'm not sure if the attachment has come through on the previous message as it shows up as failed on this end? So have uploaded it again now using advanced options, in the hope it comes through.

    I have created macro menu lists for all my various macros now, but if there is a way to create sub menus, so I can keep it all in one menu I would really appreciate knowing the VB code for it.

    Thanks in advance...
    Attached Images Attached Images
    Last edited by SCACCHIA; 11-13-2014 at 01:43 AM.

  10. #10
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Losing a custom menu bar within Windows menu bar when new excel session is opened.

    I can't ever see attached images, so I don't know if that's your problem or mine. Here's the full code, with a submenu added and one item under it.
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    08-15-2014
    Location
    India
    MS-Off Ver
    2007
    Posts
    57

    Re: Losing a custom menu bar within Windows menu bar when new excel session is opened.

    Hi,

    I think I should create Create a New Post, however I am asking here hoping to get a +ve feedback at the earliest, Can you give a sample copy of the custom menu, just wish to know how they are created, if you can.

    Thanks in advance.

    Reg,
    CVishu

  12. #12
    Registered User
    Join Date
    10-04-2014
    Location
    Sydney, Australia
    MS-Off Ver
    2003
    Posts
    18

    Re: Losing a custom menu bar within Windows menu bar when new excel session is opened.

    Excellent 'Natefarm', you're the best... The above works like a charm, I am now able to use this code and create my own menus for all my Macros. Thanks a mill, you're a champ...

  13. #13
    Registered User
    Join Date
    08-15-2014
    Location
    India
    MS-Off Ver
    2007
    Posts
    57

    Re: Losing a custom menu bar within Windows menu bar when new excel session is opened.

    Hi,

    As requested before can you share the xlsm sheet with code on how to remove standard menu bar in that file only and to creat custom menu.

    Thanks in Advance.

    Reg,
    CVishu

  14. #14
    Registered User
    Join Date
    10-04-2014
    Location
    Sydney, Australia
    MS-Off Ver
    2003
    Posts
    18

    Re: Losing a custom menu bar within Windows menu bar when new excel session is opened.

    Hi CVishu,

    You need to create your own post and these guys will then respond to you directly.

    The above code will create and delete if you copy/paste it into your VB as a code.

    Rgds,
    Steve

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Replace standard shortcut menu with custom menu
    By kemit in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-24-2014, 07:12 AM
  2. [SOLVED] Trying to 'Grey Out' menu items on Custom Menu if Workbook is ReadOnly
    By TC1980 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 07-30-2013, 08:22 AM
  3. How to rename a Custom Menu Item in the Menu Bar?
    By Sven in forum Excel General
    Replies: 3
    Last Post: 02-25-2008, 09:06 AM
  4. Losing Custom Menu When Embedded Chart Selected
    By RobertL in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-02-2007, 01:08 PM
  5. Adding Sub Menu Item to Current Custom Menu
    By Renato in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-18-2005, 08:55 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1