Forum Discussion

DaDude's avatar
DaDude
Copper Contributor
Nov 20, 2025

Context menu immediately closing after opening

When I try to open the context menu using my mouse, trackpad or keyboard button it opens and immediately closes again. It only happens when a certain workbook is open, also effecting all other excel instances.
Other pop ups behave similarly, for example when i want to open the vba menu it always focuses on the workbook windows instead of the vba window, sometimes it changes so that the vba window gets focused and I cant return to the worksheet. Other pop ups arent effected, like for example any settings menu.

When im in the VBA window the context menu works normally.

When clicking on the windows part of the window e.g. the title bar, it works normally as well.

In the trust center I disabled all vba macros, my vba code is disabled using Application.EnableEvents = False, even though I didnt have this problem with the code running before.

Im having this problem for a few days now, so I have restarted my PC and excel multiple times.
Its a really strange problem and I have no idea what the cause could be and it became weirder and weirder while I was trying out stuff before posting here, so im very happy about every possible solution :)

1 Reply

  • NikolinoDE's avatar
    NikolinoDE
    Platinum Contributor

    This behaviour (context menu instantly closing, focus snapping back to the workbook, VBA window refusing to stay focused, etc.) is almost always caused by one of three things:

    a broken or invisible UserForm that is being kept modeless
    a stuck event handler (even if macros are disabled now)
    a corrupted workbook window state

     

    Check if a hidden/ac­tive UserForm is blocking input

    Check for a stuck event handler

    Check for window corruption

    Open the workbook in Excel Safe Mode

    Check for an endless BeforeRightClick event

     

    If none of the above fixes it

    • Does it happen with only one workbook?
    • Does it happen even after you copy all sheets to a new workbook?
    • Does it occur if you upload the file here?

    Your description matches either a hidden modeless UserForm or Application.Interactive = False.

     

    Hope this helps you.

Resources