If you get Error #5152 when running code that saves a file, check whether there is a date formatted with slashes (2/15/2010) in the file name.
Slashes are not permitted in file names, so you will get this error when trying to save a file including a date in this format.
To avoid this error, format a date used in a file name with a format that uses dashes (2-15-2010 or 15-Feb-2010) instead of slashes.