REFERENCE
U.ON_CLOSE
Summary
If present, special handling will be applied when the workbook is closed. If no parameters are set, default behavior is to close the workbook without saving or prompting the user to save if the workbook is read-only
Syntax
Parameters
| Parameter | Required | Description |
|---|---|---|
[save] |
No | If set to TRUE then the workbook will be saved before it is closed |
[no_dialog] |
No | If set to TRUE then any dialog prompting the user to save the workbook before it is closed is suppressed. Set to FALSE to explicitly show that dialog when the workbook has changed even if the workbook is in read-only mode |
[close_instance] |
No | If set to TRUE then all other workbooks in the current Excel instance are also closed, optionally with a different save setting. Also can take a list of workbooks to be closed, which can be open in the current or another Excel instance (if open in a different Excel instance, that instance must be control-enabled for the close to be applied) |
Behavior
The documented public interface is supported by the current U Add-in source signature and the maintained Usage Examples workbook. Optional parameters are shown in square brackets in the syntax above; omit the brackets when entering a formula.
Return Value
Returns the function result or action status described by the formula and parameters above. The maintained sources do not define a narrower, stable return contract for this function.
Examples
Notes
- Formula examples are preserved from maintained workbook usage and normalized to the current
U.prefix. - Complete formulas demonstrate working patterns; they do not imply that undocumented option values are supported.
- Where maintained sources do not specify every accepted value, default, or error message, this page does not infer one.
- For functions that perform actions, use a visible trigger or supported block/throttle parameter to avoid unintended repetition during recalculation.
Related
- Concept: Workbook Automation
- How-to: Control Another Workbook
- Example: Remote-Controlled Workbook