writerespassword is not working

M

Moselle

below is my code. when i clock my macro button. it will automaticall
save my excel sheet but i can only open it with password. whenever i tr
to open it with my wrirespassword. it just prompt the CAPS LOCKs error
im new to excel and i totally have no idea why this happen when th
password works well as i need to open it in writeable version wit
wrirespassword. if i remove the password:= and just used th
wrirespassword. it will auto save as open excel without encryp
anything. please help me on this :(


Sub SaveInvWithNewName()
Dim NewFN As String
' Copy Invoice to a new workbook
ActiveSheet.Unprotect 111
ActiveSheet.Copy
NewFN = "Users/cs/Desktop" & Range("E3").Value & ".xlsx"
ActiveWorkbook.SaveAs NewFN, FileFormat _
:=xlNormal, Password:="222", WriteResPassword:="333", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
NextInvoice
ActiveSheet.Protect 111

End Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Copy and Pasting with Macros 0
Simplify save code 11
Hiding an Excel file using VBA 1
save & backup file 1
Protect a sheet 3
Save with ref. to cell A1 2
Looping Question 3
Need Help with VBA SaveAs 1

Top