columbo1977
Programmer
Hi All
I have code that copies selected sheets to a new workbook then emails that file to a specific address. I want to them password protect that workbook. but I cnnot specify the locaion it will be saved as it is attached to an email? I just need it saving with a password in the email for security purposes. please see below for the code and what I am trying to do.
I have code that copies selected sheets to a new workbook then emails that file to a specific address. I want to them password protect that workbook. but I cnnot specify the locaion it will be saved as it is attached to an email? I just need it saving with a password in the email for security purposes. please see below for the code and what I am trying to do.
Code:
Sub Send1Sheet_ActiveWorkbook()
'ActiveSheet.Copy
Sheets(Array("1", "2", "3", "4", "5", "6")).Copy
For Each Worksheet In Sheets(Array("1", "2", "3", "4", "5", "6"))
Worksheet.Protect Password:="ORANGE"
Next Worksheet
ActiveWorkbook.SaveAs Filename:=LocalFileName, Password:="12"
'ActiveWorkbook.SaveAs Filename:="test.xls", FileFormat:= _
'xlNormal, Password:="1234", WriteResPassword:="x", ReadOnlyRecommended:= _
'True, CreateBackup:=False
Workbook.Protect Password:="test"
With ActiveWorkbook
.SendMail Recipients:="XXX@XXX.uk", _
Subject:="Test"
.Close SaveChanges:=False
End With
End Sub