+ Reply to Thread
Results 1 to 3 of 3

rename worksheets after copy

  1. #1
    Qaspec
    Guest

    rename worksheets after copy

    I want to rename "Emp1" to "NewData". Here is my code.

    Private Sub Send1_Click()
    Dim strDate As String
    Sheets(Array("Emp1", "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


  2. #2
    Tom Ogilvy
    Guest

    Re: rename worksheets after copy

    Private Sub Send1_Click()
    Dim strDate As String, sName as STring
    Sheets(Array("Emp1", "Main")).Copy
    strDate = Format(Date, "dd-mm-yy") & " " & Format(Time, "h-mm-ss")
    Worksheets("Emp1").Name = "NewData"
    ActiveWorkbook.SaveAs "NewEmployeeData.xls"
    ActiveWorkbook.SendMail "", _
    "Employee Attendance Data"
    sname = ActiveWorkbook.Fullname
    ActiveWorkbook.Close False
    Kill sName
    End Sub

    --
    Regards,
    Tom Ogilvy


    "Qaspec" <Qaspec@discussions.microsoft.com> wrote in message
    news:664CCF3B-9C62-4AC0-BD5C-0A2FB06CBA25@microsoft.com...
    > I want to rename "Emp1" to "NewData". Here is my code.
    >
    > Private Sub Send1_Click()
    > Dim strDate As String
    > Sheets(Array("Emp1", "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
    >




  3. #3
    Ron de Bruin
    Guest

    Re: rename worksheets after copy

    Hi Qaspec

    Use this

    Sheets(Array("Emp1", "Main")).Copy
    Sheets("Emp1").Name = "NewData"


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl



    "Qaspec" <Qaspec@discussions.microsoft.com> wrote in message news:664CCF3B-9C62-4AC0-BD5C-0A2FB06CBA25@microsoft.com...
    >I want to rename "Emp1" to "NewData". Here is my code.
    >
    > Private Sub Send1_Click()
    > Dim strDate As String
    > Sheets(Array("Emp1", "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
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1