How to use Application.TransitionMenuKeyAction in the xlwings API way

The TransitionMenuKeyAction property of the Application object in Excel is a legacy feature primarily designed for compatibility with older Lotus 1-2-3 spreadsheet software. Its function is to control how Excel interprets the forward slash (/) key press when it is the first key entered into a cell. In Lotus 1-2-3, this key combination was used to activate the menu system. Excel can mimic this behavior for users transitioning from that environment, either by displaying the Excel menu bar or by simply inserting a forward slash character into the active cell.

Syntax in xlwings:
The property is accessed through the main app object, which represents the Excel Application. It can be both read and written.

app.transition_menu_key_action

This property accepts and returns an integer value (or a constant from the xlwings.constants enumeration) that specifies the desired action. The possible values are:

Valuexlwings ConstantDescription
0xlExcelMenus (or None)The forward slash key activates the Excel menu bar.
1xlLotusHelpThe forward slash key simply enters a / character into the cell.

Code Examples:

  1. Reading the Current Setting:
    This example checks the current behavior of the / key and prints a corresponding message.
import xlwings as xw
from xlwings.constants import xlExcelMenus, xlLotusHelp

app = xw.apps.active

current_action = app.transition_menu_key_action

if current_action == xlExcelMenus:
    print("The forward slash key currently activates the Excel menu bar.")
elif current_action == xlLotusHelp:
    print("The forward slash key currently enters '/' into the cell.")
else:
    print(f"Unknown setting value: {current_action}")
  1. Changing the Setting:
    This example changes the behavior so that pressing / at the start of a cell entry will simply insert the character, not open menus.
import xlwings as xw
from xlwings.constants import xlLotusHelp

app = xw.apps.active

# Set the property to enter the slash character
app.transition_menu_key_action = xlLotusHelp
print("Transition menu key action set to 'xlLotusHelp'.")

July 25, 2026 (0)


Leave a Reply

Your email address will not be published. Required fields are marked *