View Full Version : Solved: Create new folder within VB
IrishCharm
04-02-2008, 03:04 AM
Hi,
I want to save down a file but create a new folder each time automatically through VB.
For Example: File = Fish1.xls
I want to save this into folder
DAY_0: C:\DAY_0\FISH1.XLS
Tomorrow the file needs to be saved into a folder called
DAY_1: C:\DAY_1\FISH1.XLS
Any idea how this is done?
Cheers
georgiboy
04-02-2008, 03:09 AM
I dont know if this is exactly what you need but it should help
Sub MakeCopy()
ActiveWorkbook.SaveCopyAs ActiveWorkbook.Path & "\" & _
Split(ActiveWorkbook.Name, ".")(0) & Format(Date, "-yymmdd") & ".xls"
End Sub
IrishCharm
04-02-2008, 03:30 AM
I dont know if this is exactly what you need but it should help
Sub MakeCopy()
ActiveWorkbook.SaveCopyAs ActiveWorkbook.Path & "\" & _
Split(ActiveWorkbook.Name, ".")(0) & Format(Date, "-yymmdd") & ".xls"
End Sub
Hi,
Not able to make that work. Basically if i have a file C:\TEST\fish.xls and i want to save down the same file every day but in a different folder specified within the code (which needs to be created each day) i cant seem to find this.
For example:
C:\TEST\fish.xls
-->> saves down and creates new day folders automatically to produce:
C:\TEST\MONDAY\fish.xls
C:\TEST\TUESDAY\fish.xls
C:\TEST\WEDESDAY\fish.xls
... ETC
Bob Phillips
04-02-2008, 04:19 AM
MkDir "C:\Test\" & Format(Date,"dddd")
ActiveWorkbook.SaveAs "C:\Test\" & Format(Date,"dddd") & "\fish.xls"
IrishCharm
04-02-2008, 04:37 AM
MkDir "C:\Test\" & Format(Date,"dddd")
ActiveWorkbook.SaveAs "C:\Test\" & Format(Date,"dddd") & "\fish.xls"
That works perfectly thanks so much for that!!
Saves me so much hardship!!!
:beerchug:
Aussiebear
04-02-2008, 12:17 PM
Hi, Kinkykuddles, Welcome to vbaexress forum. If you believe tha this issue is solved, would you kindly mark it as "solved by using the thread tools options.
Thank you
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.