+ Reply to Thread
Results 1 to 4 of 4

Loop through files failing

  1. #1
    Registered User
    Join Date
    02-06-2013
    Location
    Sheffield
    MS-Off Ver
    2007
    Posts
    32

    Loop through files failing

    I have a loop script to run through all files in a particular folder. It works perfectly if all I want to do is for a message box to popup telling me the file name, loops through each one no problem.

    What I want to do is replace the message box with other actions that need to be performed on each of those files in the folder but fails after actioning the first file with file name being returned as ".."

    This is my code,

    Please Login or Register  to view this content.

  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: Loop through files failing

    mdex

    Have you checked to see if there is anything in the procedures that are being called that could interfere with the use of Dir?

    For example, is there any code in them that uses Dir?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    02-06-2013
    Location
    Sheffield
    MS-Off Ver
    2007
    Posts
    32

    Re: Loop through files failing

    Yes, I think there is. I'll have a check in the morning.

  4. #4
    Registered User
    Join Date
    02-06-2013
    Location
    Sheffield
    MS-Off Ver
    2007
    Posts
    32

    Re: Loop through files failing

    Quote Originally Posted by Norie View Post
    mdex

    Have you checked to see if there is anything in the procedures that are being called that could interfere with the use of Dir?

    For example, is there any code in them that uses Dir?
    Thanks again Norie,

    I did indeed have another use of Dir. I got around this by creating an array using FSO and looping through that instead.

+ 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. SaveAsPDF Macro Failing (Loop-and-Save Macro Combo)
    By eNinjaInTraining in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-19-2018, 12:55 PM
  2. Loop through multiple files and call macros (but unable to loop)
    By ryanpetersen in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-23-2014, 12:04 PM
  3. Replies: 5
    Last Post: 11-19-2013, 04:11 PM
  4. VBA Loop for a folder of all the files, Loop all the worksheet in each workbook
    By nanjingwoodworking in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-07-2013, 07:20 PM
  5. [SOLVED] Loop in different files
    By jnh0 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-01-2013, 10:50 AM
  6. Replies: 0
    Last Post: 03-13-2013, 09:08 PM
  7. Loop failing to extract data.
    By JapanDave in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-06-2011, 06:04 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