ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Moving a file from one folder to another (https://www.excelbanter.com/excel-programming/333289-moving-file-one-folder-another.html)

scantor145[_11_]

Moving a file from one folder to another
 

Excel 2002 with Visual Basic 6.3

I have a file, say it's called test.txt, in C:\. During the course o
running a particular macro I would like to find that file, move it an
save it to another folder, say C:\My Documents.

Any ideas for the procedure?

Thank

--
scantor14
-----------------------------------------------------------------------
scantor145's Profile: http://www.excelforum.com/member.php...fo&userid=1476
View this thread: http://www.excelforum.com/showthread.php?threadid=38351


Liedson31

Moving a file from one folder to another
 
Hi Scantor
try this one:

Dim fs
Set fs = CreateObject("Scripting.FileSystemObject")

FileCopy "c:\book1.xls","c:\My Documents\book1.xls" 'this one copy
fs.DeleteFile ("c:\book1.xls"), FORCE:=True 'this one delete

cheers
Miguel

"scantor145" wrote:


Excel 2002 with Visual Basic 6.3

I have a file, say it's called test.txt, in C:\. During the course of
running a particular macro I would like to find that file, move it and
save it to another folder, say C:\My Documents.

Any ideas for the procedure?

Thanks


--
scantor145
------------------------------------------------------------------------
scantor145's Profile: http://www.excelforum.com/member.php...o&userid=14766
View this thread: http://www.excelforum.com/showthread...hreadid=383519



Tom Ogilvy

Moving a file from one folder to another
 
name "C:\test.txt" as "C:\My Documents\test.txt"

--
Regards,
Tom Ogilvy

"scantor145" wrote
in message ...

Excel 2002 with Visual Basic 6.3

I have a file, say it's called test.txt, in C:\. During the course of
running a particular macro I would like to find that file, move it and
save it to another folder, say C:\My Documents.

Any ideas for the procedure?

Thanks


--
scantor145
------------------------------------------------------------------------
scantor145's Profile:

http://www.excelforum.com/member.php...o&userid=14766
View this thread: http://www.excelforum.com/showthread...hreadid=383519





All times are GMT +1. The time now is 10:16 PM.

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