Thanks for replying back. when I run the program against a local directory. It works fine but If I run it against a map drive. It doesn't work and it gave me the error message. could you tell me what could I do to rewrite my code so I read the file with no problems.?