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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
Sub RecupererLesImagesEnVertical(ByVal FeuilleEnCours As Worksheet, ByVal CelluleImage As Range, ByVal Repertoire As String)
Dim MonImage As Shape
Dim MonFichier As String
Dim NbImages As Integer
Dim PositionGauche As Double
Dim PositionHaut As Double
FeuilleEnCours.Activate
For Each MonImage In FeuilleEnCours.Shapes
Select Case Mid(MonImage.Name, 1, Len("ImageFeuille"))
Case "ImageFeuille"
Application.DisplayAlerts = False
MonImage.Delete
Application.DisplayAlerts = True
End Select
Next MonImage
On Error Resume Next
ChDir Repertoire
PositionGauche = CelluleImage.Left
PositionHaut = CelluleImage.Top
NbImages = 1
MonFichier = Dir(Repertoire & "\*.*")
Do While MonFichier <> "" ' Commence la boucle.
Select Case Mid(MonFichier, 1, Len(CelluleNomPrenom))
Case CelluleNomPrenom
RecupererLesInformationsSurLImage Repertoire & "\" & MonFichier
PhotoTrouvee = True
Select Case FormatImage
Case "Paysage"
ActiveSheet.Shapes.AddShape(msoShapeRectangle, PositionGauche, PositionHaut, HauteurImagePaysage, HauteurImagePaysage / RatioImage).Select
Selection.Name = "ImageFeuille" & NbImages
With Selection.ShapeRange.Fill
.Visible = msoTrue
.UserPicture Repertoire & "\" & MonFichier
.TextureTile = msoFalse
.ForeColor.ObjectThemeColor = msoThemeColorText1
End With
With Selection.ShapeRange.Line
.Visible = msoTrue
.Weight = 1
End With
PositionHaut = PositionHaut + (HauteurImagePaysage / RatioImage) + 10
Case "Portrait"
ActiveSheet.Shapes.AddShape(msoShapeRectangle, PositionGauche, PositionHaut, HauteurImagePortrait, HauteurImagePortrait / RatioImage).Select
Selection.Name = "ImageFeuille" & NbImages
With Selection.ShapeRange.Fill
.Visible = msoTrue
.UserPicture Repertoire & "\" & MonFichier
.TextureTile = msoFalse
.ForeColor.ObjectThemeColor = msoThemeColorText1
End With
With Selection.ShapeRange.Line
.Visible = msoTrue
.Weight = 1
End With
PositionHaut = PositionHaut + (HauteurImagePortrait / RatioImage) + 10
End Select
NbImages = NbImages + 1
End Select
MonFichier = Dir ' Extrait l'entrée suivante.
Loop
End Sub |
Partager