+ Reply to Thread
Results 1 to 4 of 4

Creating new workbook, saving as csv and then closing - but closing always fails.

  1. #1
    Registered User
    Join Date
    03-19-2014
    Location
    USA
    MS-Off Ver
    Excel 2011
    Posts
    4

    Creating new workbook, saving as csv and then closing - but closing always fails.

    Hi,
    I am new to Excel/VBA, working on a Mac, and have tried searching around for an answer, but even the answers I find that seem like they would help, have not. I'm selecting a row from my current workbook/sheet, copying and pasting it into a new workbook, saving that one row as a .csv file (that all works)...and then trying to close the new, open workbook and go back to the first one. I have tried variations of the .Close and I have tried setting variables for the active workbooks when the two different ones are active, but I keep getting an error on the close.

    All of my code for this part is commented out because every attempt has failed, but the rest of the code for everything else will not work if I don't get this workbook closed and back to the original workbook. Below is what I've tried so far. I hope I've made at least some sense.
    Thanks in advance for any help!

    Please Login or Register  to view this content.
    Last edited by ella626; 03-28-2014 at 11:44 AM. Reason: Didn't use code tags the first time, sorry!

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Creating new workbook, saving as csv and then closing - but closing always fails.

    How does this not work?
    Please Login or Register  to view this content.
    That is the code you would use to close the active workbook without saving changes.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    03-19-2014
    Location
    USA
    MS-Off Ver
    Excel 2011
    Posts
    4

    Re: Creating new workbook, saving as csv and then closing - but closing always fails.

    Thank you - I should have posted errors along with my code.

    When I use that specific code, this is the error I get:

    Run-time error '1004':
    Method 'Close' of object '_Workbook' failed.

  4. #4
    Registered User
    Join Date
    03-19-2014
    Location
    USA
    MS-Off Ver
    Excel 2011
    Posts
    4

    Re: Creating new workbook, saving as csv and then closing - but closing always fails.

    I really don't know why the error is occurring - it seems like it should be very simple to close the active workbook. The thing is that there are no errors when I comment out the code to close the active workbook, so it leads me to believe that the error is really with that specific action. I have to have this done as soon as possible -- does anyone have any suggestions for a workaround? Is there a way that I could accomplish this same thing without opening and closing a new workbook?
    Thank you so much for any help!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Closing the workbook without saving
    By tushar@excel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-30-2008, 05:20 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. Saving and Closing Workbook
    By Jim28 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-23-2006, 12:30 PM
  5. [SOLVED] Closing a workbook without saving from Word
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-09-2005, 05:05 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