How to dynamically set password for entire excel workbook?

I want to dynamically set password for the entire workbook without using third party activities

Hi @May_Prince

We can do this with invoke VBA and excel applications scope like this

image

Here is the txt doc
image

Sub SetWorkbookPassword()
Dim strPassword As String
strPassword = "yourpassword"
ActiveWorkbook.Password = strPassword
End Sub

Regards!

it is working if only the excel is open. It should work without opening …Please help

Kindly uncheck the visible property

image

Regards

I have unchecked and tried it is showing this error

I have deleted the file and only tried it as new file still this issue is there

That is because you already assing the password, so you have to fill the password in order tor ead it correctly again
image

Regards

Even if i am trying to creating the new file still I get the same error