Results 1 to 6 of 6

fso.DeleteFolder works first time, not second

Threaded View

  1. #1
    Registered User
    Join Date
    04-12-2011
    Location
    Leeds, England
    MS-Off Ver
    Excel 2007/2010
    Posts
    67

    fso.DeleteFolder works first time, not second

    Hi,

    I'm pulling my hair out with this problem and would appreciate some help. I'm pretty sure that the first time I run my program it is keeping the folder or file in use somehow so the second time I run it the deletefolder command won't work.

    Unfortunately the code is pretty lengthy and hard to follow so I'll just try and describe it for now:

    If the folder exists I delete it with fso.DeleteFolder then recreate it and make a few files in it. I use fso objects and also set an object for each file but I've tried setting them to nothing at the end with:
    Set RepSheet = Nothing
    Set fso = Nothing

    The files/folder is not open when I run the second time but still it won't work so I must be missing something. Any advice gratefully received.

    Chinchin.
    Last edited by Leith Ross; 07-01-2011 at 11:50 AM. Reason: Added Code Tags

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