Share via


Workbook.ChangeFileAccess Method (Excel)

Changes the access permissions for the workbook. This may require an updated version to be loaded from the disk.

Syntax

.ChangeFileAccess(Mode, WritePassword, Notify)

A variable that represents a Workbook object.

Parameters

Name

Required/Optional

Data Type

Description

Mode

필수

XlFileAccess

Specifies the new access mode.

WritePassword

선택

Variant

Specifies the write-reserved password if the file is write reserved and Mode is xlReadWrite. Ignored if there's no password for the file or if Mode is xlReadOnly.

Notify

선택

Variant

True (or omitted) to notify the user if the file cannot be immediately accessed.

Remarks

If you have a file open in read-only mode, you don't 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

참고 항목

개념

Workbook Object Members

Workbook Object