Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default copy active worksheet plus another worksheet

No luck answering this one myself.
I'd like to send the active worksheet plus a copy of another worksheet in my
workbook.

here is my code I tried but Iget subscript out of range

Private Sub Send1_Click()
Dim strDate As String
ActiveSheet.Copy
Worksheets("Main").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

Thanx


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default copy active worksheet plus another worksheet

Private Sub Send1_Click()
Dim strDate As String
ActiveSheet.Copy
ThisWorkbook.Worksheets("Main").Copy After:= _
Activeworkbook.Worksheets(1)
strDate = Format(Date, "dd-mm-yy") & " " & Format(Time, "h-mm-ss")
ActiveWorkbook.SendMail "", _
"Employee Attendance Data"
ActiveWorkbook.Close False
End Sub

You don't do anything with strDate and you don't have an email address in
SendMail.

If you want the workbook to have a specific name


Private Sub Send1_Click()
Dim strDate As String, aFname as String
ActiveSheet.Copy
ThisWorkbook.Worksheets("Main").Copy After:= _
Activeworkbook.Worksheets(1)
strDate = Format(Date, "dd-mm-yy") & " " & Format (Time, "h-mm-ss")
ActiveWorkbook.SaveAs "NewEmployeeData.xls"
sFname = ActiveWorkbook.FullName
ActiveWorkbook.SendMail "", _
"Employee Attendance Data"
ActiveWorkbook.Close False
Kill sFname
End Sub


--
Regards,
Tom Ogilvy




"Qaspec" wrote in message
...
No luck answering this one myself.
I'd like to send the active worksheet plus a copy of another worksheet in

my
workbook.

here is my code I tried but Iget subscript out of range

Private Sub Send1_Click()
Dim strDate As String
ActiveSheet.Copy
Worksheets("Main").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

Thanx




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Value of Active cell and 25 rows above to a diff worksheet ash3154 Excel Discussion (Misc queries) 4 September 2nd 09 12:56 AM
Macro to copy active worksheet to new workbook Macca Excel Discussion (Misc queries) 1 May 25th 08 02:07 PM
copy active cell value,find the pasted value in different worksheet [email protected] Excel Worksheet Functions 2 July 9th 06 09:56 AM
Copy worksheet from Active workbook into all other open workbooks TroyB[_2_] Excel Programming 0 February 10th 04 10:29 AM
macro to apply worksheet event to active worksheet Paul Simon[_2_] Excel Programming 3 August 7th 03 02:50 AM


All times are GMT +1. The time now is 05:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"