ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error handler not handling (https://www.excelbanter.com/excel-programming/416615-error-handler-not-handling.html)

[email protected]

Error handler not handling
 
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



All times are GMT +1. The time now is 04:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com