|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Option Explicit
Private Function FindPicDate(PicFile As String) As String
Dim bytes() As Byte
Dim sLine() As String
Dim fSize As Long, ExifDate As Long
Dim i As Long, d As Long
Dim ff As Integer
Dim Found As Boolean
ff = FreeFile
fSize = FileLen(PicFile)
If fSize > 1024 Then fSize = 1024
ReDim bytes(1 To fSize)
Open PicFile For Binary As #ff
Get #ff, 1, bytes
Close ff
sLine = Split(StrConv(bytes(), vbUnicode), Chr$(0))
For i = 0 To UBound(sLine)
ExifDate = InStr(1, sLine(i), "xif")
If ExifDate > 0 Then
Found = True
Exit For
End If
Next i
If Found = False Then Exit Function
For d = i + 1 To UBound(sLine)
ExifDate = InStr(1, sLine(d), ":")
If ExifDate > 0 Then
FindPicDate = sLine(d)
Exit For
End If
Next d
End Function |
|