Moving workbooks between folders

O

Ozzie

I have a problem in that I currently run a macro that opens all the workbooks
in a particular folder, and merges the data onto one new worksheet, which
works fine.

However I need to add a bit of code that will move the original workbook into
a new folder called say 'archive' so that the original folder is now empty
and the archive folder is populated??

anyone have any idea's?, anything appreciated

Cheers, David
 
R

Ron de Bruin

Hi Ozzie

Why not give it a new name and add a new folder when you are ready

Name "C:\Data\" As "C:\Data " & Format(Now, "dd-mm-yy h-mm-ss") & "\"
MkDir "C:\Data\"
 
B

bigwheel

Something along these lines presumably:-

Sub MoveAFile()
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.MoveFile "C:\testfile.txt", "C:\winnt\testfile.txt"
End Sub
 
D

david giles via OfficeKB.com

Ron,

Many thanks for your response and for the others, I tried both answers but
your won, it works a treat, thanks again

Hi Ozzie

Why not give it a new name and add a new folder when you are ready

Name "C:\Data\" As "C:\Data " & Format(Now, "dd-mm-yy h-mm-ss") & "\"
MkDir "C:\Data\"
I have a problem in that I currently run a macro that opens all the workbooks
in a particular folder, and merges the data onto one new worksheet, which
[quoted text clipped - 7 lines]
Cheers, David
 
Top