+ Reply to Thread
Results 1 to 10 of 10

Saving only the current, active workbook

  1. #1
    Registered User
    Join Date
    05-09-2010
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    41

    Saving only the current, active workbook

    I was given the following code and when I added it to my project, it did not work as expected. It was suppose to open up a "save as" box and save only the current active workbook. For some reason it opens a "save as" box and saves a single worksheet, but the saved worksheet does not contain any of the data from the active worksheet. I've tried to tweak it to get it to work as I need, but no luck. Any ideas?

    Please Login or Register  to view this content.
    Last edited by SinGin; 05-16-2010 at 10:41 AM.

  2. #2
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Saving only the current, active workbook

    Hi SimGin,

    Try this instead...

    Please Login or Register  to view this content.
    abousetta

  3. #3
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: Saving only the current, active workbook

    try to remove this line and see whether you can run the macro

    ThisWorkbook.ActiveSheet.Copy

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Saving only the current, active workbook

    Hi SinGin,

    Is this thread a continuation of another thread http://www.excelforum.com/excel-prog...worksheet.html ? If so, please close one of them so are not responding to the same question on multiple threads.

    abousetta

  5. #5
    Registered User
    Join Date
    05-09-2010
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    41

    Re: Saving only the current, active workbook

    Thanks a lot for your help, it's still not quite working like I was hoping though.

    The code you provided doesn't run all the way and the debugger calls up this line -->wb.SaveAs DstFile 'Save file

    Your second suggestion (to remove that one line from the original code) saves the entire spreadsheet to include all workbooks. What I need is for it to save only the current sheet, but not to exit the original spreadsheet because I need to save other parts of it separately.

    It is a continuation of another post. I had actually marked it as solved at one point before I realized it wasn't quite working and since it was old it didn't seem like it was getting any suggestions after I marked it "unsolved" for lack of a better term. I'd be more than happy to close the original and have tried, but for the life of me can not figure out how. As much as you've helped me already I hate to even ask, but can you tell me how to close a post?

  6. #6
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Saving only the current, active workbook

    Hi SinGin,

    Could you post a dummy workbook? The code works fine on my computer, and I don't know why its not working on yours. Also could you tell me what the error message says.

    abousetta

  7. #7
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Saving only the current, active workbook

    Hi SinGin,

    Try adding this to the top of top of the code I sent you after the declarations:

    Please Login or Register  to view this content.
    Let me know if it works.

    abousetta

  8. #8
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Saving only the current, active workbook

    Hi SinGin,

    I tried the following code out on a dummy workbook and it seems to work.

    Please Login or Register  to view this content.
    abousetta

  9. #9
    Registered User
    Join Date
    05-09-2010
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    41

    Re: Saving only the current, active workbook

    Abousetta, you're a genius! Thanks a lot man, really. I realize why they weren't working for me. The macros I built would change the name of a few sheets and hide a few and for some reason the code you wrote didn't like that. Once I took that part of my code out it worked great! I used the last code you gave me and it worked perfectly, the other solutions might work for me now too but I haven't had a chance to try them yet. Thanks again.

  10. #10
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Saving only the current, active workbook

    Hi SinGin,

    All the code I have provided you with was created through the help of good people on this site and other similar sites. I am only an amateur at writing code and am just trying to help others whenever I can. I'm glad the code worked for you as it has worked for me.

    Good luck,

    abousetta

+ 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