Opens a sheet as a document within an MDI frame window for dockable windows.

Applies to

Window objects


OpenSheetAsDocument ( sheetrefvar {, windowtype }, mdiframe, sheetname {, tabalign } )




The name of any window variable that is not an MDI frame window. OpenSheetAsDocument places a reference to the open sheet in sheetrefvar.

windowtype (optional)

A string whose value is the datatype of the window you want to open. The datatype of windowtype must be the same or a descendant of sheetrefvar.


The name of an MDI frame window.


A unique string identifier for the sheet, which is used when layout is persisted.

tabalign (optional)

A boolean that, when used, creates a new tab group and indicates the alignment of the sheets in the group. When true, the tabs in the group align vertically. When false, the tabs align horizontally.

Return value


Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is null, OpenSheetAsDocument returns null. In some cases, such as if the windowtype argument is invalid, OpenSheetAsDocument throws a runtime error and does not return a value; therefore, it is recommended that you both test the return value and wrap the function call in a try-catch block.


Tabbed documents can be in more than one tab group. Users can create additional tab groups by dragging one tab outside of the current group. If there is more than one tab group, use the mdiframe argument to specify in which one to open a sheet. Instead of specifying the parent window, specify an already open sheet in the tab group where you want to open your new sheet.