I have the following code which I use to get date properties of some jpg files. I am trying to have it so I can extract day()
month()
and year()
from this. It works most of the time but on occasion, there are some rogue ?
in there. I have tried getproperty1 = Replace(getproperty1, "?", "")
however this does not work (and wasnt really expecting it to)
intPos = InStrRev(strFile, "\")
strPath = Left(strFile, intPos)
strName = Mid(strFile, intPos + 1)
''debug.print intPos & " .. " & strPath & " .. " & strName
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(strPath)
Set objFolderItem = objFolder.ParseName(strName)
If Not objFolderItem Is Nothing Then
getproperty1 = objFolder.GetDetailsOf(objFolderItem, n)
If getproperty1 = vbNullString Then
getproperty1 = objFolder.GetDetailsOf(objFolderItem, 4)
End If
I am wanting it to always be readable as a date at least, as I will be passing it all back to a duplicate file (see Rotate a saved image with vba for more of an idea as to what I do with it) using some more code I have modified from Chip Pearson's site (http://www.cpearson.com/excel/FileTimes.htm) to write it back to the file which takes the datetime as Double
(so will be running Dateserial()+Timeserial()
at that point. There are reasons stopping me passing datetime directly between the two as I sometimes need to make amendments in between the two bits of code)