View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] sbitaxi@gmail.com is offline
external usenet poster
 
Posts: 158
Default 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