Skip to content

Latest commit

 

History

History
47 lines (29 loc) · 1.01 KB

Excel.Workbook.WritePassword.md

File metadata and controls

47 lines (29 loc) · 1.01 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Workbook.WritePassword property (Excel)
vbaxl10.chm199210
vbaxl10.chm199210
Excel.Workbook.WritePassword
ac89063e-6ef5-f7c5-abb0-4e6ef1c5fd05
05/29/2019
medium

Workbook.WritePassword property (Excel)

Returns or sets a String for the write password of a workbook. Read/write.

Syntax

expression.WritePassword

expression A variable that represents a Workbook object.

Example

In this example, if the active workbook is not protected against saving changes, Microsoft Excel sets the password to a string as the write password for the active workbook.

Sub UseWritePassword() 
 
 Dim strPassword As String 
 
 strPassword = InputBox ("Enter the password") 
 
 ' Set password to a string if allowed. 
 If ActiveWorkbook.WriteReserved = False Then 
 ActiveWorkbook.WritePassword = strPassword 
 End If 
 
End Sub

[!includeSupport and feedback]