Move a file without opening it.

D

David Seebaran

Hi all,

Hope someone can help.

Is it possible to move a file from one sub-directory to another without
opening it.

The problem is that my program is relying on only opening '.xls' files of a
specific filename convention. Therefore, if someone has put a file in the
sub-directory that is not what I am looking for, I want to move it. At the
moment I just 'Kill' the erroneous file but that is not very friendly, on
the other hand, I don't want to 'Open' it, 'Save' it to a new location and
then 'Kill' it in it's original location.

Regards,


David Seebaran.

E-mail: [email protected]
 
C

Chip Pearson

David,

Assuming that both directories exist, you can use the Name statement to move
the file from one directory to the other. E.g,

Name "C:\Test\Test.txt" As "C:\Test2\Test.txt"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Top