Skip to content

Instantly share code, notes, and snippets.

@Trshant
Created November 11, 2013 05:33
Show Gist options
  • Save Trshant/7408394 to your computer and use it in GitHub Desktop.
Save Trshant/7408394 to your computer and use it in GitHub Desktop.
A friend wanted a way to make folders for every day of the year 2012. Made one in python. Another suggested that VBA script is a nicer alternative. This is my first VBA script, Learnt and Written on the fly :)
Set objFSO = CreateObject("Scripting.FileSystemObject")
y = ""
MyDate = DateSerial(2012, 1, 1)
y = year(MyDate)*10000+month(MyDate)*100+day(MyDate)
WScript.echo y
objFSO.CreateFolder y
For counterVariable = 1 to 366
MyDate1 = DateAdd("d", counterVariable , MyDate )
y = year(MyDate1)*10000+month(MyDate1)*100+day(MyDate1)
objFSO.CreateFolder y
Next
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment