Moving a file
Oh sorry, I cant make it static in the code because the
values in both of the cells will change.
Thanx
-----Original Message-----
Hi Todd
I think this'll work (but not heavy-duty tested):
Sub test()
Name "C:\Temp\Book1.xls" As "D:\Data\Book1.xls"
End Sub
if not then here's the more traditional way; copy and
delete:
Sub test2()
Dim FileFrom As String
Dim FileTo As String
FileFrom = "D:\Data\Book1.xls"
FileTo = "C:\Temp\Book1.xls"
FileCopy FileFrom, FileTo
DoEvents
If Dir(FileTo) < "" Then Kill FileFrom
End Sub
--
HTH. Best wishes Harald
Followup to newsgroup only please.
"Todd Huttenstine"
wrote in message
...
In cell A6 is a new value(Full file path) and in cell A7
is the old value(Full file path).
For instance: Cell A6 = P:\My Stats.xls
and Cell A7= C:\Config\My Stats.xls
What is the code to move the file from the old file path
to the new file path? In this case I will need My
Stats.xls to be moved from C:\Config to P:\.
This can be done by copying the file and deleting the
file
in the old path or by just moving it.
It really does not matter I just need the file moved on
the above criteria.
Thank you
Todd Huttenstine
.
|