Skip to main content

Workbook.AutoSaveOn property

Table of contents
  1. Syntax
  2. Remarks
  3. Example

True if the edits in the workbook are automatically saved. Read/write Boolean.

Syntax

expression.AutoSaveOn

expression A variable that represents a Workbook object.

Remarks

When a new workbook is created, the default value for the AutoSaveOn property is False, the property is disabled, and the user's changes will need to be saved manually. However, if the workbook is hosted in the cloud (that is, OneDrive, OneDrive for Business, or SharePoint Online), the AutoSaveOn property defaults to True and the edits in the specified workbook are automatically saved. If a cloud-hosted workbook is shared with other users, their changes will also be automatically merged into the user's local copy when AutoSaveOn is True.

The following table shows examples of AutoSaveOn behavior.

AutoSaveOn toggle state Set AutoSaveOn to True Set AutoSaveOn to False
AutoSaveOn == True No-op AutoSaveOn turned off
AutoSaveOn == False AutoSaveOn turned on No-op
Disabled Error Error

For more information about AutoSave, see How AutoSave impacts add-ins and macros.

Example

This example notifies you whether the workbook is set to be automatically saved.

Sub UseAutoSaveOn()
    MsgBox "This workbook is being saved automatically: " & ActiveWorkbook.AutoSaveOn
End Sub

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>