Export (0) Print
Expand All
Expand Minimize

Workbook.ReadOnlyRecommended Property

Gets or sets a value that indicates whether the workbook was saved as read-only recommended.

Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in microsoft.office.tools.excel.dll)

public virtual bool ReadOnlyRecommended { get; set; }

Property Value

true if the workbook was saved as read-only recommended; otherwise, false.

When you open a workbook that was saved as read-only recommended, Microsoft Office Excel displays a message recommending that you open the workbook as read-only.

Use the SaveAs method to change this property.

The following code example displays a message box if the ReadOnlyRecommended property is true and the ReadOnly property is false, and then prompts the user to set the file access to read-only by calling the ChangeFileAccess method.

private void MakeWorkbookReadOnly()
    if (this.ReadOnlyRecommended && !this.ReadOnly)
        // Change the access level of the document to read-only if the user 
        // clicks yes.
        if (MessageBox.Show("Set this document to read-only?",
            "Sample", MessageBoxButtons.YesNo) == DialogResult.Yes)
                missing, false);

© 2014 Microsoft