Error handler not handling

S

sbitaxi

Hi:

I created an error handler to create a directory if the path wasn't
found, and it has stopped working. I'm not sure why it is not going to
the Handler now.

DestBk is a workbook
SavePath is a string for the file path "C:\Temp"
Data is a string used to name the file, assigned dynamically in the
code. "Donations" for example.

FileExtStr is a String = ".xls" if the version is pre 2007

FileFormatNum is -4143, if the version is pre 2007


On Error GoTo PathError

DestBk.SaveAs SavePath & Year(Date) & "\" &
MonthName(Month(Date) - 1) _
& " " & Year(Date) & "\" & _
Data & "_" & Format(Now(),
"MMM_DD_YYYY") & FileExtStr, _
FileFormatNum


PathError: MkDir (SavePath & Year(Date) & _
"\" & MonthName(Month(Date) - 1) & " " &
Year(Date))
Resume
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top