Handling an error in VBA/Excel - TechRepublic
General discussion
June 26, 2000 at 02:12 PM
jim_rau

Handling an error in VBA/Excel

by jim_rau . Updated 25 years, 11 months ago

I just don’t see what I am missing an really need to get past this! I find error handling in VB Help but just when I think I have what I need and run it I cause Excel to stop responding. I need a complete answer here … after 4 hours I give up.

I have a folder named C:\MyFolder and in it should be 10 files (named MyFile1.txt, MyFile2.txt, etc.). It is possible that some of the 10 are missing or too big.

What is the VBA code that will open each file in turn and IF IT IS NOT IN THE FOLDER copy a sample file (named MyFile0.txt) with the name of the missing file (i.e. MyFile0.txt copied as MyFile3.txt)? If the file is there then it has to be less than 12KB or I need to copy the sample in place of the file as well (same MyFile0.txt).

The code really has to work and to the person with the best solution … 1000 points! If the code does not fit you can e:mail it to me at jim_rau@prevos.com.

Save me from this … please!!!

This discussion is locked

All Comments