Hi,
I want move all the xls files from a folder (C:\Test) to a subfolder (C:\Test\2009), but not move "ThisWorkbook".
I try this
but isnt working at all.![]()
Please Login or Register to view this content.
Thanks in advance for any help
Hi,
I want move all the xls files from a folder (C:\Test) to a subfolder (C:\Test\2009), but not move "ThisWorkbook".
I try this
but isnt working at all.![]()
Please Login or Register to view this content.
Thanks in advance for any help
Last edited by Jokacave; 04-22-2010 at 02:07 PM.
Hello Jokacave,
Here is the amended macro. This is much easier to do with VBA than the FSO.
![]()
Please Login or Register to view this content.
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Hi Leith Ross,
Thank you for trying to help me...
I try ur code but don.t move any file to the subfolder.
Try this:
![]()
Please Login or Register to view this content.
Entia non sunt multiplicanda sine necessitate
Hello Jokacave,
Did it create the the new directory? Have you saved the workbook with the macro?
Yes, to both questions.
Hello Jokacave,
The Name ... As statement should have moved the file to the new directory. What version of Excel are you using?
The 2003 version
Hello Jokacave,
Sorry, I didn't catch this earlier. The to folder in the Name As statement is misspelled. It should be this...
![]()
Please Login or Register to view this content.
I try ur code but move every file and I want move all the files but not the files where is the code. And i need create the subfolder before run the code but i think i can turn around that "problem".
Hello Jokacave,
I ran the macro and it skips moving the workbook the macro is in. Did you want to do something different?
Leith Ross,
Great. Now, works perfectly.
Thk u 4 ur help.
Hi shg,
Thk u 4 ur help. Ur code have a few froblems 4 what I want - I posted at 01:44 AM.
Thk u anyway
Hi, theres a few problems you face with the existing code...
1) the folder already exists when you try and make it
2) user enters an invalid folder name
3) code doesnt actually loop through files etc.
Heres 2 pieces of code - insert both into the VBE and then run the MoveExcelFiles sub
This function returns true if the folder name is acceptable to Windows or false if its not
This code copies over Excel files to your new subfolder![]()
Please Login or Register to view this content.
regards,![]()
Please Login or Register to view this content.
Graham
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks