Changes the menu associated with a window. If the window is an MDI frame window, ChangeMenu appends the list of open sheets to the currently active menu.

Applies to

Window objects


windowname.ChangeMenu ( menuname {, position } )




The name of the window for which you want to change the menu.


The name of the menu you want to make the current menu.

position (MDI frame windows only)

The number of the item on the menu bar to which you want to append the names of the open sheets. Items on the menu bar are numbered from the left, beginning with 1. The default is 0, which lists the open sheets on the menu bar's next-to-last menu (or the last menu if there is only one available).

Return value


Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is null, ChangeMenu returns null. The return value is usually not used.


If you are changing the menu associated with an MDI frame window, the new menu will not be visible if an open sheet with its own menu is active. When a sheet has its own menu, the list of open sheets appears on its menu, as well as on the hidden menu for the frame.

In an MDI frame window, if you change to a menu with a different menu and toolbar style (traditional or contemporary), the style of the menu changes but the style of the toolbar does not.


This statement changes the top-level menu of the w_Employee window to m_Emp1: