XL.Sheet.SetPrintFit
--------------------

Fits sheet width and sheet height to wPages and hPages respectively.

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

MBS( "XL.Sheet.SetPrintFit"; BookRef; SheetIndex { ; wPages; hPages } ) 

**MBS**( **"XL.Sheet.SetPrintFit";** /\* Fits sheet width and sheet height to wPages and hPages respectively. \*/  
**$BookRef**; /\* The reference number for the workbook.e.g. $ref \*/   
**$SheetIndex**; /\* The index of the sheet. This number ranges from 0 to [XL.Book.SheetCount](XLBookSheetCount.md)-1.e.g. 0 \*/   
**$wPages**; /\* Optional; The number of pages horizontally. Default is 1.e.g. 1 \*/   
**$hPages**) /\* Optional; The number of pages vertically. Default is 1.e.g. 1 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| BookRef | The reference number for the workbook. | $ref |  |
| SheetIndex | The index of the sheet. This number ranges from 0 to [XL.Book.SheetCount](XLBookSheetCount.md)-1. | 0 |  |
| wPages | The number of pages horizontally. Default is 1. | 1 | Optional |
| hPages | The number of pages vertically. Default is 1. | 1 | Optional |

### Result

Returns OK or error.

### Description

Fits sheet width and sheet height to wPages and hPages respectively.  
### See also

- [XL.Book.SheetCount](XLBookSheetCount.md)
- [XL.Sheet.GetPrintArea](XLSheetGetPrintArea.md)
- [XL.Sheet.GetPrintFit](XLSheetGetPrintFit.md)
- [XL.Sheet.GetPrintRow](XLSheetGetPrintRow.md)
- [XL.Sheet.GetPrintZoom](XLSheetGetPrintZoom.md)
- [XL.Sheet.GetProtect](XLSheetGetProtect.md)
- [XL.Sheet.SetPrintArea](XLSheetSetPrintArea.md)
- [XL.Sheet.SetPrintRow](XLSheetSetPrintRow.md)
- [XL.Sheet.SetPrintZoom](XLSheetSetPrintZoom.md)
- [XL.Sheet.SetProtect](XLSheetSetProtect.md)

This function checks for a license.

Created 18th August 2014 , last changed 9th July 2015

  
[XL.Sheet.SetPrintArea](XLSheetSetPrintArea.md) - [XL.Sheet.SetPrintGridlines](XLSheetSetPrintGridlines.md)

[HTML Version](XLSheetSetPrintFit.shtml)