+ Reply to Thread
Results 1 to 7 of 7

Macro to free drive space before saving

  1. #1
    Registered User
    Join Date
    02-28-2012
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    Excel 2007
    Posts
    37

    Macro to free drive space before saving

    Hi guys,

    I was hoping one of you gents could help me with a small matter.

    In my workplace, we use a network drive that is constantly full. A lot of times when I try to save an excel file I get the message saying that the drive is full, which is a pain. I created a folder in there where I keep some junk files (around 1Mb each) so I can move them to my personal drive to be able to save my file. After I save, I move back the files, so I will always have some space to free up.

    I was wondering if there is a code that would move some files in this folder (around 10 files would propably do), and then return them to their original place, for whenever this error occurs, perhaps something similar to a Workbook Before Save...

    Let's say the network drive is called "R:\Network\MyFolder" and the personal is "C:\Junk Files"

    Many thanks!!!!
    Last edited by pedrofogao21; 10-26-2012 at 08:26 AM. Reason: Solved thread

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,995

    Re: Macro to free drive space before saving

    If they're junk files, there doesn't seem much point moving them backwards and forwards. You could just keep a copy of them on your local drive and delete them from the network drive when you need space there. After you've done whatever, copy them back.

    Seems a bit of overkill to drive this from Excel. You might just as well have a couple of batch files for before and after save.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    02-28-2012
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Macro to free drive space before saving

    Yes, I could delete and copy them back, no problem.
    It might be overkill....I don't know if the code would take longer to run that the time it takes to do it manually..

    I only ask because I have to do this several times every day, so if there was something simple to run it could be better to have Excel do it...

    Thanks again

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Macro to free drive space before saving

    is getting more disks an option? they're pretty cheap these days and I doubt your excel issue is the only problem you have if your network is full! ;-)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,995

    Re: Macro to free drive space before saving

    You could use Notepad to create a couple of DOS batch files. Intheory, you could run them from Excel but I don't think it's worth it.

    CopyFiles.bat

    HTML Code: 

    DelFiles.bat

    HTML Code: 

    You will not be asked for confirmation or see any display on the Cmd window. You can run them from Windows Explorer by double clicking on them or you could put shortcuts on your desktop.


    Regards, TMS

  6. #6
    Registered User
    Join Date
    02-28-2012
    Location
    Rio de Janeiro, Brazil
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Macro to free drive space before saving

    OK, thanks for your help TMS

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,995

    Re: Macro to free drive space before saving

    You're welcome. Thanks for the rep.


    Please mark your thread as solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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