With the below coding, I am able to create a copy of password protected file. But I also want to put the password in newly created file. How can I add password while creating new excel workbook.
Workbooks.Open Filename:=myFileNameDir, Password:="yourpassword", UpdateLinks:=0
Set ws1 = Worksheets("OJT Plan")
ws1.Activate
filen = TextBox3.Text & "_" & TextBox59 & "_" & VBA.Format(Now, "MMddyyyyhmmss AM/PM ")
ws1.SaveAs Sheet1.Range("V3").Value & filen & ".xlsx"
Worksheets.Add(after:=Worksheets(Worksheets.Count)).Name = "Details"
Set ws13 = Worksheets("Details")
If you look at the documentation you will see there are two password arguments for the
SaveAs
commandThe difference in these two password arguments is explained in the docs: