XL.Book.ErrorCode
-----------------

Queries the last error code.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [XL](component_XL.md) | [16.1](newinversion161.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "XL.Book.ErrorCode"; BookRef ) 

**MBS**( **"XL.Book.ErrorCode";** /\* Queries the last error code. \*/  
**$BookRef**) /\* The reference number for the workbook.e.g. $ref \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| BookRef | The reference number for the workbook. | $ref |

### Result

Returns number or error.

### Description

Queries the last error code.  
Possible values:  
  
| Constant | Value | Description |
|---|---|---|
| ERRCODE\_OK | 0 | Everything was fine. |
| ERRCODE\_INCORRECTPASSWORD | 1 | Incorrect password for encrypted workbook. |
| ERRCODE\_ROWOUTOFRANGE | 2 | Row is out of range. |
| ERRCODE\_COLOUTOFRANGE | 3 | Column is out of range. |
| ERRCODE\_INDEXOUTOFRANGE | 4 | Index is out of range. |
| ERRCODE\_INDEXNOSENSE | 5 | Indexes are meaningless for this function. |
| ERRCODE\_LASTSHEET | 6 | Workbook must contain at least one visible worksheet. |
| ERRCODE\_SHEETNOTFOUND | 7 | Sheet is not found. |
| ERRCODE\_NAMECUTOFF | 8 | Name was truncated. |
| ERRCODE\_FORMULASYNTAXERROR | 9 | Error in formula expression. |
| ERRCODE\_SHEETNAMEINVALID | 10 | Sheet name has an invalid character. |
| ERRCODE\_FILENAMEINVALID | 11 | File name can't be NULL. |
| ERRCODE\_NAMEALREADYEXIST | 12 | Workbook already contains such a sheet name. |
| ERRCODE\_FILENOTAVAILABLE | 13 | Can't open file or path is incorrect. |
| ERRCODE\_FILEFORMATNOTSUPPORTED | 14 | File isn't an Excel file or it is not supported. |
| ERRCODE\_FUNCNOTSUPPORTEDFORXLS | 15 | This function is not supported for xls files. |
| ERRCODE\_FUNCNOTSUPPORTEDFORXLSX | 16 | This function is not supported for xlsx files. |
| ERRCODE\_LOADEDONLYINFO | 17 | Only workbook information was loaded. |
| ERRCODE\_FONTSIZEOUTOFRANGE | 18 | Font size is out of range. |
| ERRCODE\_NOFONTS | 19 | Workbook doesn't have fonts. |
| ERRCODE\_STRINGTOOLONG | 20 | String is too long. |
| ERRCODE\_STRINGNULL | 21 | String is NULL. |
| ERRCODE\_AUTOFILTERNULL | 22 | AutoFilter can't be NULL. |
| ERRCODE\_OUTLINELEVELEXCEEDED | 23 | Exceeded outline level for groups. |
| ERRCODE\_LOCALEERROR | 24 | Can't apply the specified locale. |
| ERRCODE\_XMLERROR | 25 | Workbook is corrupted, error in XML. |
| ERRCODE\_BIFFRECERROR | 26 | Workbook is corrupted, error in BIFF record. |
| ERRCODE\_IOERROR | 27 | Can't read or write. |
| ERRCODE\_CONSISTENCYERROR | 28 | Data inconsistency was found. |
| ERRCODE\_OUTOFMEMORY | 29 | Not enough memory. |
| ERRCODE\_UNKNOWNSTYLE | 30 | Unknown cell style. |
| ERRCODE\_FORMATNULL | 31 | Format is NULL. |
| ERRCODE\_FORMATNOTFOUND | 32 | Format is not found. |
| ERRCODE\_PARENTFORMATNOTFOUND | 33 | Parent format is not found. |
| ERRCODE\_FONTNOTFOUND | 34 | Font is not found. |
| ERRCODE\_TABLENOTFOUND | 35 | Table is not found. |
| ERRCODE\_RICHSTRINGNOTFOUND | 36 | Rich string is not found. |
| ERRCODE\_PROPNOTFOUND | 37 | Property is not found. |
| ERRCODE\_UNKNOWNCHAR | 38 | Found an unknown character that can't be processed. |
| ERRCODE\_CHARNOTALLOWED | 39 | Some particular symbols are not allowed here. |
| ERRCODE\_CELLNOTFOUND | 40 | Cell is not found. |
| ERRCODE\_CELLNOTMERGED | 41 | Cell is not in merged cells. |
| ERRCODE\_CELLTYPEINCORRECT | 42 | Cell doesn't contain the requested type. |
| ERRCODE\_HEIGHTTOOHIGH | 43 | Height is too big. |
| ERRCODE\_PICERROR | 44 | Picture is corrupted or it has unknown format. |
| ERRCODE\_PICPOSERROR | 45 | Incorrect picture position. |
| ERRCODE\_PICNOTFOUND | 46 | Picture is not found. |
| ERRCODE\_PICSIZEINCORRECT | 47 | Incorrect picture size. |
| ERRCODE\_PICOFFSETEXCEED\_XY | 48 | Picture offset\_x and offset\_y exceed cell's size. |
| ERRCODE\_PICOFFSETEXCEED\_Y | 49 | Picture offset\_y exceeds cell's height. |
| ERRCODE\_PICOFFSETEXCEED\_X | 50 | Picture offset\_x exceeds cell's width. |
| ERRCODE\_NOFREECOLORINDEX | 51 | There is no free color index for xls format. |
| ERRCODE\_COLORINVALID | 52 | Color is invalid. |
| ERRCODE\_PRINTTITLESNOTFOUND | 53 | Print titles are not found. |
| ERRCODE\_NAMEDRANGENOTFOUND | 54 | Named range is not found. |
| ERRCODE\_NAMEDRANGESKIPPED | 55 | Some parts of named range were skipped. |
| ERRCODE\_PAGEBREAKALREADYEXIST | 56 | Page break already exists. |
| ERRCODE\_PAGEBREAKNOTFOUND | 57 | Page break is not found. |
| ERRCODE\_PAGEBREAKLIMIT | 58 | Number of page breaks exceeds the limit. |
| ERRCODE\_IGNOREDERRALREADYEXIST | 59 | Ignored error already exists. |
| ERRCODE\_OVERLAP | 60 | Range overlap was detected. |
| ERRCODE\_SHEETNOTSPLITTED | 61 | Worksheet is not splitted. |
| ERRCODE\_DIRENTRYINCORRECTNAME | 62 | Found an incorrect name in the directory entry inside xls file. |
| ERRCODE\_REFINVALID | 63 | Reference has unrecognized format. |
| ERRCODE\_REFNOTFOUND | 64 | Reference is not found. |
| ERRCODE\_DATEINVALID | 65 | Date is not recognized. |
| ERRCODE\_XLSERROR | 66 | XLS file is corrupted. |
| ERRCODE\_CONVERROR | 67 | String conversion error, probably incorrect locale. |
| ERRCODE\_TOOMANYFORMATS | 68 | Too many cell formats. |
| ERRCODE\_TOOMANYFONTS | 69 | Too many fonts. |
| ERRCODE\_NOSTYLES | 70 | Styles are not found. |
| ERRCODE\_NOID | 71 | ID is not found. |
| ERRCODE\_FILTERCOLUMNNULL | 72 | Filter column is NULL. |
| ERRCODE\_FILTERVALUENOTFOUND | 73 | Filter value is not found. |
| ERRCODE\_FILTERNOTFOUND | 74 | Filter is not found. |
| ERRCODE\_DATAVALIDNOTFOUND | 75 | Data validations are not found. |
| ERRCODE\_ACTIVECELLNOTFOUND | 76 | Active cell is not found. |
| ERRCODE\_HYPERLINKNOTFOUND | 77 | Cell doesn't have a hyperlink. |
| ERRCODE\_SORTNOTFOUND | 78 | Sorting in AutoFilter is not found. |
| ERRCODE\_CONTROLNOTFOUND | 79 | Control is not found. |
| ERRCODE\_AUTOFITERROR | 80 | Can't calculate the cell's width. |
| ERRCODE\_VALUEOUTOFRANGE | 81 | Value is out of range. |
| ERRCODE\_ZIPERROR | 82 | ZIP library error. |
| ERRCODE\_EXCEPTION | 83 | STL exception error. |
| ERRCODE\_TRIALLIMIT | 84 | Limitations of the trial version. |

### Release notes

- **Version 16.1**
    - Added [XL.Book.Clear](https://www.mbsplugins.eu/XLBookClear.shtml) and [XL.Book.ErrorCode](https://www.mbsplugins.eu/XLBookErrorCode.shtml) functions.

### Blog Entries

- [LibXL 5.2 released](https://www.mbsplugins.de/archive/2026-06-13/LibXL_52_released/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 16.1 News](https://www.mbsplugins.de/archive/2026-03-31/MBS_FileMaker_Plugin_161_News/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 16.1pr1](https://www.mbsplugins.de/archive/2026-02-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

Created 20th January 2026 , last changed 20th January 2026

  
[XL.Book.DeleteSheetsExcept](XLBookDeleteSheetsExcept.md) - [XL.Book.FontCount](XLBookFontCount.md)

[HTML Version](XLBookErrorCode.shtml)