Excel VisualBasic Script

Sub passWrite()
    ActiveWorkbook.WritePassword = "pass"
End Sub