A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
At the end of that line, add
, Password:="..."
where ... is the password you want to set for opening the workbook.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
We have an Excel template that we use in our office for accounting purposes. It has a lot of VBA that automates our internal processes and even saves the workbook with a specific name. When my coworkers create the file, they always forget to password protect it so that only those with the password can open it. Is there a way to automate the process of password protecting the file with additional VBA code?
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
At the end of that line, add
, Password:="..."
where ... is the password you want to set for opening the workbook.
Thanks.
There is already the line: ThisWorkbook.SaveAs
Can I add it to that? If so, what is the proper format?
Thanks again
You write that you have code to save the workbook with a specific name. Assuming that you use a line such as
ActiveWorkbook.SaveAs Filename:="..."
you can specify the password in that line:
ActiveWorkbook.SaveAs Filename:="...", Password:="..."