columbo1977
05-09-2008, 01:48 AM
Hi All
I have code that will email the active worksheet when a button is pressed.
What I need to do with this is attach several worksheets from the same workbook to this email instead of just one. and the workbook needs to be password protected when emailed as there is confidential information in it.
please see code below as an example of what I have been trying to do.
Sub Send1Sheet_ActiveWorkbook()
'Create a new Workbook from the sheet and then emails _
it to the address below
'ActiveSheet.Copy
Sheets("CM400-1", "CM400-2", "CM400-3", "CM400-4", "CM400-5", "CM400-6").Select ?????? this is what isnt working.
ActiveSheet.Protect Password:="???" ????? this and code above origionally was only used for one sheet.
With ActiveWorkbook
.SendMail Recipients:="???@???.com", _
Subject:="Test of sheet Protect"
.Close SaveChanges:=False
End With
End Sub
Private Sub CommandButton3_Click()
' This puts a date / time stamp in K13 so that you know when the form was sent
ActiveSheet.Unprotect Password:="???"
Range("P13").Select
ActiveCell.Formula = Now()
Range("B1:G70").Select
Selection.NumberFormat = "General"
Selection.Locked = True
Selection.FormulaHidden = False
Range("A1").Select
ActiveSheet.Protect Password:="???"
Call Send1Sheet_ActiveWorkbook
Thanks
Columbo1977
I have code that will email the active worksheet when a button is pressed.
What I need to do with this is attach several worksheets from the same workbook to this email instead of just one. and the workbook needs to be password protected when emailed as there is confidential information in it.
please see code below as an example of what I have been trying to do.
Sub Send1Sheet_ActiveWorkbook()
'Create a new Workbook from the sheet and then emails _
it to the address below
'ActiveSheet.Copy
Sheets("CM400-1", "CM400-2", "CM400-3", "CM400-4", "CM400-5", "CM400-6").Select ?????? this is what isnt working.
ActiveSheet.Protect Password:="???" ????? this and code above origionally was only used for one sheet.
With ActiveWorkbook
.SendMail Recipients:="???@???.com", _
Subject:="Test of sheet Protect"
.Close SaveChanges:=False
End With
End Sub
Private Sub CommandButton3_Click()
' This puts a date / time stamp in K13 so that you know when the form was sent
ActiveSheet.Unprotect Password:="???"
Range("P13").Select
ActiveCell.Formula = Now()
Range("B1:G70").Select
Selection.NumberFormat = "General"
Selection.Locked = True
Selection.FormulaHidden = False
Range("A1").Select
ActiveSheet.Protect Password:="???"
Call Send1Sheet_ActiveWorkbook
Thanks
Columbo1977