Name
workbook
.ChangeFileAccess(Mode
, [WritePassword
], [Notify
])
Synopsis
Changes a workbook to read-only or read/write access.
Argument |
Settings |
---|---|
|
|
|
The password required for write access if the workbook is write-protected. |
|
True displays a message if the file is not available for read/write access, perhaps because it is open for another user; False does not notify. Default is True. |
Switching a read-only workbook to read/write may reload the file in Excel. The following code demonstrates changing file-access modes on the current workbook:
' Save changes. ThisWorkbook.Save ' Change to read-only. ThisWorkbook.ChangeFileAccess xlReadOnly ' Change back. (May reload file.) ThisWorkbook.ChangeFileAccess xlReadWrite
Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.