1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| Dim Chemin As String
Dim MyFSO As Scripting.FileSystemObject
Dim myFolder As Folder
Dim Monfichier As Object
Chemin = CurrentProject.Path & "\" & Me.Annee & "\" & Me.NOAffaire & "\PHOTOS\"
Set MyFSO = New Scripting.FileSystemObject
Set myFolder = MyFSO.GetFolder(Chemin)
'Supprime les enregistrements existant dans ExportPhotos
DoCmd.RunSQL "DELETE * FROM ExportPhotos"
'Récupération des données EXIF
'¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Dim Fic As String: Dim Orient As Integer: Dim DateCl As Date: Dim lat As String: Dim Lon As String
For Each Monfichier In myFolder.Files
With CreateObject("WIA.ImageFile")
.LoadFile Monfichier
Debug.Print Monfichier
Fic = Monfichier.Name
Rep = Chemin
With .Properties("GpsLatitude").Value
'Debug.Print .Item(1).Value + .Item(2).Value / 60 + .Item(3).Value / 3600
lat = .Item(1).Value + .Item(2).Value / 60 + .Item(3).Value / 3600
End With
With .Properties("GpsLongitude").Value
Lon = .Item(1).Value + .Item(2).Value / 60 + .Item(3).Value / 3600
End With
Orient = .Properties("Orientation").Value
DateCl = Replace(.Properties("DateTime"), ":", "/", 1, 2)
End With
Call CurrentDb.Execute("INSERT INTO ExportPhotos (Fichier, Orientation, DateCliche, Latitude, Longitude, Répertoire) VALUES ('" & Fic & "'," & Orient & ",#" & DateCl & "#,'" & lat & "','" & Lon & "','" & Rep & "')")
Next Monfichier |
Partager