sending the active worksheet and an additional new sheet

Q

Qaspec

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
 
Q

Qaspec

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
 

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

Top