hello all.
I am going to be modifying my process and codes later but in the meantime i need help with this quirk.
i am generating individual workbooks based on UID and placing them in a seperate directory. While the workbook is being saved, I want to password protect the workbook based on EMPLID which is included in the list. I saw this vba code on the internet while searching.
On my code, i have the EMPLID as string already named. This is how the workbook is being currently saved in my code:
ActiveWorkbook.SaveAs pathStr & "\Reports\" & reportName
I have the EMPLID already defined as a string, would i modify my save as code as
ActiveWorkbook.SaveAs pathStr & "\Reports\" & reportName , FileFormat:= _ xlNormal, Password:=EMPLID, WriteResPassword:=EMPLID, ReadOnlyRecommended:=False _ , CreateBackup:=False"
I am going to test it out to see if it works but let me know if i am on the right track. attached is the workbook with code
I am going to be modifying my process and codes later but in the meantime i need help with this quirk.
i am generating individual workbooks based on UID and placing them in a seperate directory. While the workbook is being saved, I want to password protect the workbook based on EMPLID which is included in the list. I saw this vba code on the internet while searching.
Code:
ActiveWorkbook.SaveAs filename:="C:\SAP Imports\Sales Orders\"& Range("A1")&".xlsm", FileFormat:= _ xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _ , CreateBackup:=False
On my code, i have the EMPLID as string already named. This is how the workbook is being currently saved in my code:
ActiveWorkbook.SaveAs pathStr & "\Reports\" & reportName
I have the EMPLID already defined as a string, would i modify my save as code as
ActiveWorkbook.SaveAs pathStr & "\Reports\" & reportName , FileFormat:= _ xlNormal, Password:=EMPLID, WriteResPassword:=EMPLID, ReadOnlyRecommended:=False _ , CreateBackup:=False"
I am going to test it out to see if it works but let me know if i am on the right track. attached is the workbook with code
Attachments
Last edited by a moderator: