Results 1 to 7 of 7

Thread: Disable Excel Menu options on startup

  1. #1

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Disable Excel Menu options on startup

    I know there are a couple of macros that are used for this purpose ... something like "AutoExecute" or something like that.

    Its been aaaaaaaaaaaaaaaaaaaages since I did this ... and due to the permanent detrimental affects of alcohol I can't remember how to do it.

    Basically, when you open excel is there any way of creating a macro which removes either a) the whole pull down menu or b) indiv items on the pull-down menu.

    Sorry and Thanks .... for being so stupid and for helping ... in that order

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Disable Excel Menu options on startup

    Event of the loading spreadsheet?

    Commandbars (in the microsoft office x.x objects reference).
    Your choice whether to loop and .find controls then enable, visible etc them...
    or just get rid of the menus.

    All toolabrs and menus are commandbars, and you can make them all disappear in a loop should you want to.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Re: Disable Excel Menu options on startup

    Yes in the loading of the spreadsheet.
    I'm not referring to any custon custom menus, I'm referring purely to the default ones, say for example if you wanted to disable the "Save" and "Save As" options in the "File" pull down menu.
    Isn't there a standard amcro called "AutoExecute" that yuo can use that will execute when Excel starts up ? Or did I dream that ?

  4. #4
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Disable Excel Menu options on startup

    There is an autoexecute macro (not vba) in Access.

    As to specifiy, you could loop through all the controls (using .find I think or just moving through all the controls) and check their captions (replace & with "") to see if they are like Save ... then you can .enable=false on them. Whether Excel would change that if the user loaded a new sheet, or created a new sheet, you'd have to test.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  5. #5

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Re: Disable Excel Menu options on startup

    If I remember correctly there is an option to say "temporary change" or "permanent change"
    The temporary change only lasts as long as that particular session of Excel is open.
    The permanent one obviously lasts indefinately.

    There IS an "AutoExecute" standard macro in Excel, because I have used it before.
    Not sure if thats the correct name for it though.

    A sample of code from someone would be good, because like anyone who knows me will tell .... I'm bl**dy lazy

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Disable Excel Menu options on startup

    Wouldnt you just use the _Open event?
    VB Code:
    1. Private Sub Workbook_Open()
    2.     MsgBox "Hi"
    3. End Sub
    Note: In Excel you can disable the code from running by holding down the shift key when starting Excel.
    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

  7. #7

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Re: Disable Excel Menu options on startup

    No because thats specific to the workbook and not the environment.

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