ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Moving workbooks between folders (https://www.excelbanter.com/excel-discussion-misc-queries/67062-moving-workbooks-between-folders.html)

Ozzie

Moving workbooks between folders
 
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

Ron de Bruin

Moving workbooks between folders
 
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\"


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ozzie" <u18021@uwe wrote in message news:5ad7ac35d415c@uwe...
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




bigwheel

Moving workbooks between folders
 
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

"Ozzie" wrote:

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


david giles via OfficeKB.com

Moving workbooks between folders
 
Ron,

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


Ron de Bruin wrote:
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


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200601/1


All times are GMT +1. The time now is 08:37 AM.

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