Results 1 to 4 of 4

opening new workbook and saving sheet

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357

    opening new workbook and saving sheet

    I am trying to write code which copies the activesheet (called "Data"), opens a new workbook, pastes the data into it and closes the new sheet as "sales 2008" followed by the date. What I have at the moment is:
    Sub save_sheets_as_workbooks()
    Dim d As String
    Dim a As Integer
    
        Sheets("data").Select
        Sheets("data").copy
        d = ThisWorkbook.path & "\" & Workbooks("sales 2008.xls") & "  " & Day(Date) & "." & Month(Date) & "." & Year(Date) & ".xls"
    
        ActiveWorkbook.SaveAs d9
        ActiveWorkbook.Close
       '
    End Sub
    Unfortunately it's not working. It opens a new workbook (called book1) but then tries to close my existing workbook
    Last edited by tryer; 10-21-2008 at 07:37 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Add-in to saving groups of worksheets as a single workbook
    By l8sk8r in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-11-2008, 07:34 AM
  2. Closing Workbook without saving Changes
    By Sam I Am in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-10-2008, 08:02 PM
  3. closing a workbook without saving and closing a workbook with saving enabled
    By stanigator in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-24-2007, 02:15 PM
  4. Shared Workbook - Saving Issues
    By nyeoman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2007, 11:21 PM
  5. how to close a workbook without saving a individual worksheet?
    By vjarowdy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-28-2007, 05:44 PM

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