![]() |
sending the active worksheet and an additional new sheet
I'd like to send the active worksheet plus an additional worksheet that I
would like to name. I want to name the new worksheet "Main". Here is the code I have that allows me to send the active sheet. What do I add in there to allow me to also add in a blank named worksheet? Private Sub Send1_Click() Dim strDate As String ActiveSheet.Copy strDate = Format(Date, "dd-mm-yy") & " " & Format(Time, "h-mm-ss") ActiveWorkbook.SaveAs "NewEmployeeData.xls" ActiveWorkbook.SendMail "", _ "Employee Attendance Data" ActiveWorkbook.ChangeFileAccess xlReadOnly Kill ActiveWorkbook.FullName ActiveWorkbook.Close False End Sub |
sending the active worksheet and an additional new sheet
Add the following
Answered my own question. Miracles do happen. Worksheets.Add.Name = "Main" right under ActiveSheet.copy Private Sub Send1_Click() Dim strDate As String ActiveSheet.Copy Worksheets.Add.Name = "Main" strDate = Format(Date, "dd-mm-yy") & " " & Format(Time, "h-mm-ss") ActiveWorkbook.SaveAs "NewEmployeeData.xls" ActiveWorkbook.SendMail "", _ "Employee Attendance Data" ActiveWorkbook.ChangeFileAccess xlReadOnly Kill ActiveWorkbook.FullName ActiveWorkbook.Close False End Sub "Qaspec" wrote: I'd like to send the active worksheet plus an additional worksheet that I would like to name. I want to name the new worksheet "Main". Here is the code I have that allows me to send the active sheet. What do I add in there to allow me to also add in a blank named worksheet? Private Sub Send1_Click() Dim strDate As String ActiveSheet.Copy strDate = Format(Date, "dd-mm-yy") & " " & Format(Time, "h-mm-ss") ActiveWorkbook.SaveAs "NewEmployeeData.xls" ActiveWorkbook.SendMail "", _ "Employee Attendance Data" ActiveWorkbook.ChangeFileAccess xlReadOnly Kill ActiveWorkbook.FullName ActiveWorkbook.Close False End Sub |
All times are GMT +1. The time now is 07:53 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com