ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Moving Files (https://www.excelbanter.com/excel-programming/347033-moving-files.html)

PraxisPete

Moving Files
 
Hi everybody

I have a workbook that contains a procedure which:

1, Opens a .xls from a SourceDir
2, Alters the contents of this .xls
3, Produces and saves a CSV file to a CSVTargetDir
4, Saves and closes the altered .xls to AnotherTargetDir

Is it possible to move the original .xls file from the SourceDir
to an ArchiveDir ?

Many thanks
PS using Excel 2002


chijanzen

Moving Files
 
PraxisPete:
Is it possible to move the original .xls file from the SourceDir
to an ArchiveDir ?


try,

Set fs = CreateObject("Scripting.FileSystemObject")
fs.CopyFile ThisWorkbook.FullName, "c:\" & ThisWorkbook.Name

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"PraxisPete" wrote:

Hi everybody

I have a workbook that contains a procedure which:

1, Opens a .xls from a SourceDir
2, Alters the contents of this .xls
3, Produces and saves a CSV file to a CSVTargetDir
4, Saves and closes the altered .xls to AnotherTargetDir

Is it possible to move the original .xls file from the SourceDir
to an ArchiveDir ?

Many thanks
PS using Excel 2002


NickHK

Moving Files
 
Pete,
Check out FileCopy and Kill.

NickHK

"PraxisPete" wrote in message
...
Hi everybody

I have a workbook that contains a procedure which:

1, Opens a .xls from a SourceDir
2, Alters the contents of this .xls
3, Produces and saves a CSV file to a CSVTargetDir
4, Saves and closes the altered .xls to AnotherTargetDir

Is it possible to move the original .xls file from the SourceDir
to an ArchiveDir ?

Many thanks
PS using Excel 2002




Bob Phillips[_6_]

Moving Files
 
Dim OldName, NewName
OldName = "OLDFILE": NewName = "NEWFILE" ' Define file names.
Name OldName As NewName ' Rename file.

OldName = "C:\MYDIR\OLDFILE": NewName = "C:\YOURDIR\NEWFILE"
Name OldName As NewName ' Move and rename file.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"PraxisPete" wrote in message
...
Hi everybody

I have a workbook that contains a procedure which:

1, Opens a .xls from a SourceDir
2, Alters the contents of this .xls
3, Produces and saves a CSV file to a CSVTargetDir
4, Saves and closes the altered .xls to AnotherTargetDir

Is it possible to move the original .xls file from the SourceDir
to an ArchiveDir ?

Many thanks
PS using Excel 2002





All times are GMT +1. The time now is 03:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com