Hey everyone. I have a macro in my program that is supposed to Zip up all of the temp files and save them into a folder on a different drive. Well, my company wants it to automatically archive all yearly quotes in a folder...So I tried to do this with the Year() method on the 4th line...The folder is named 2010 on the drive, and the year function is supposed to be in "YYYY" format...do you guys see any reason that I'm getting an Error 76 -- Path not found?
On Error GoTo NoQuoteDirectory
'Place this quote into the proper year... Dim x As Date
Dim today As String
today = Year(x)
TargetDirectory = "Q:\" + today + "\" + Directory
ChDir TargetDirectory
On Error GoTo 0
Exit Sub
'Error handler if Q: drive can't be found (not on network)
NoQDrive:
ChDrive "C"
ChDir "C:\"
Exit Sub
'Error handler if quote subdirectory can't be found
NoQuoteDirectory:
CreateDirectory = MsgBox("Quote directory cannot be found - create new directory?", vbYesNo, "QUOTE DIRECTORY")
If CreateDirectory = vbNo Then
ChDir "Q:\"
Exit Sub
Else
MkDir TargetDirectory 'Make new quote subdirectory
ChDir TargetDirectory
Exit Sub
End If
End Sub
Bookmarks