nRet = MTblExportToExcelEx( hWndTbl, cMTblExcelExpParams )

Exports a table to Microsoft Excel. Provides extended capabilities in opposite to MTblExportToExcel.

Parameters
hWndTbl
Window Handle: Handle of the table

cMTblExcelExpParams
fcMTblExcelExpParams: Parameters

Return
Number: 1 if successful or one of the following error codes:

MTE_ERR_CANCELLED

The user has cancelled the export.

MTE_ERR_RUNNING_INSTANCE

A running instance could not be found.

MTE_ERR_NEW_INSTANCE

A new instance could not be created.

MTE_ERR_STATUS

An status dialog error occured.

MTE_ERR_OLE_EXCEPTION

An OLE exception occured. The exception is reported to the user in a message box.

MTE_ERR_EXCEPTION

Another exception occured. The exception is reported to the user in a message box.

MTE_ERR_NOT_SUBCLASSED

The table isn't subclassed with MTblSubClass.

MTE_ERR_INVALID_LANG

The specified language is invalid.

Example
In this example all visible rows ( incl. split rows ) and columns of a table are "silently" exported to a file with column headers, colors, fonts and grid.
The start cell is B2 and the status dialog is shown. The language is English:

...
fcMTblExcelExpParams: params
...
Set params.Language = MTE_LNG_ENGLISH
Set params.ExcelStartCell = "B2"
Set params.ExcelSaveAsFile = "c:\\temp\\mtblexport.xls"
Set params.ExcelFlags = MTE_EXCEL_NEW_INSTANCE | MTE_EXCEL_HIDE_INSTANCE | MTE_EXCEL_CLOSE_INSTANCE
Set params.ExpFlags = MTE_COL_HEADERS | MTE_COLORS | MTE_FONTS | MTE_GRID | MTE_SPLIT_ROWS | MTE_SHOW_STATUS
Set params.RowFlagsOn = 0
Set params.RowFlagsOff = ROW_Hidden
Set params.ColFlagsOn = COL_Visible
Set params.ColFlagsOff = 0
Set nRet = MTblExportToExcelEx( hWndTbl, params )

Remarks
M!Table uses automation based on the Microsoft Excel 8.0 Object Library ( Excel 97 ) and is tested with Excel 97, 2000 and 2007. It's not guaranteed that it works with another Excel version.

When you set or omit both Excel instance flags( MTE_EXCEL_RUNNING_INSTANCE and MTE_EXCEL_NEW_INSTANCE ), M!Table first looks for a running instance. If no running instance is found, a new instance is created.

For performance reasons, automatic calculation in Excel is switched off during the export.
The original setting is restored after the export.

The following messages are sent while exporting:
MTM_QueryExcelColWidth
MTM_QueryExcelNumberFormat
MTM_QueryExcelRowHeight

See also
fcMTblExcelExpParams
MTblExportToExcel
Exports

Created with the Personal Edition of HelpNDoc: Produce electronic books easily