ChangeFileAccess Method

Applies To

Workbook Object.

Description

Changes the access permissions for the workbook. This may require loading an updated version from the disk.

Syntax

object.ChangeFileAccess(mode, writePassword, notify)

object

Required. The Workbook object.

mode

Required. Specifies the new access mode (one of xlReadWrite or xlReadOnly).

writePassword

Optional. If the file is write reserved and mode is xlReadWrite, specifies the write-reserved password. Ignored if there is no password for the file or mode is xlReadOnly.

notify

Optional. True if you wish to be notified if the file cannot be immediately accessed. Assumed to be True if omitted.

Remarks

If you have a file open in read-only mode, you do not have exclusive access to the file. If you change a file from read-only to read-write, Microsoft Excel must load a new copy of the file to ensure that no changes were made while you had the file open as read-only.

Example

This example sets the active workbook to read-only.


ActiveWorkbook.ChangeFileAccess Mode:=xlReadOnly