Move a file without opening it.

  • Thread starter Thread starter David Seebaran
  • Start date Start date
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: (e-mail address removed)
 
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
 
Hi Chip,

Thank you very much, it works perfectly.

Regards,


David Seebaran.

E-mail: (e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top