Login | |
|
 |
When moving files my code quits after the 55th fil - 5/24/2005 8:30:26 AM
|
|
 |
|
| |
dishmj
Posts: 2
Score: 0
Joined: 5/24/2005
From:
Status: offline
|
When moving files from one folder to another using the code below, I find that the filecoll quits after 55 files. I have over one hundred files to move and I find myself running this srcipt more than once to move all the files. If anyone can see anything wrong please let me know. Option Explicit '--------------------------------------- 'Moves Excel documents to archive folder '--------------------------------------- MsgBox ("Start") Dim fso, file, folderobj, filecoll Dim ProgArgs, inputFile, outputFile Dim i Set fso = CreateObject("Scripting.FileSystemObject") Set folderobj = fso.GetFolder("q:\common\statements\") Set filecoll = folderobj.Files For Each inputfile in filecoll If Mid(inputfile, 22, 5) = "excel" Then Set file = fso.OpenTextFile(inputFile, 1) fso.MoveFile "q:\common\statements\" & inputFile.name, ("q:\common\statements\xls\") End If Next Set fso=nothing Set folderobj=nothing Set filecoll=nothing MsgBox ("FINISHED")
|
|
| |
|
|
|
 |
Re: When moving files my code quits after the 55th fil - 5/25/2005 12:41:38 AM
|
|
 |
|
| |
mbouchard
Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
|
Why do you open the file before you move it? This is not needed, comment this out and then try it. Also, are all the files the same case? You may want to make this a case insensitive compare. Mid(lcase(inputfile.name),22,5) Also, on your move line you could change "q:\common\statements\" & inputFile.name to inputfile.path
|
|
| |
|
|
|
|
|