Solved: Save PDF to a year directory each new year or month

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

spooky1

Thread Starter
Joined
Jan 29, 2010
Messages
126
I have created
C:\00 - savehere \2012
C:\00 - savehere \2013
C:\00 - savehere \2014

current vba code is:-
ChDir "C:\00 - savehere \2012"
Range("c57:h102").ExportAsFixedFormat Type:=xlTypePDF, Filename:=composedfn & ".pdf"


Is there a way to save to ChDir "C:\00 - savehere \ currentyear
without having to change the vba integer value to each new year? or using if statements for each year? So when the 1st of jan comes it automatically save to the new current year directory and if possible creates a directory at the start of each new year as well?
 
Joined
Jun 8, 2001
Messages
2,583
If folder exist....

' Does this directory exist? If not, create it.
If objFSO.FolderExists(strParentPath) = False Then
Set newFolder = objFSO.CreateFolder(strParentPath)
Wscript.Echo "Put a ocr fold here" &
Else
'Save it here code'
End If

This will get you the year
CurrentDate = Date
File_Year = DatePart("yyyy",CurrentDate)

You should be able to code it with this info
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top