Bonjour,
Dans une macro excel, j'insère une image grâce à ce code :
Le problème est que je ne peux pas, de cette manière, différencier les images portrait des images paysages.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 Set Image = Worksheets("fichesdetail").Shapes.AddPicture(":photos:" & prefixe & numphoto & ".jpg", False, True, Cells(lfiche + 2, 7).Left + 1.5, Cells(lfiche + 2, 7).Top + 30, 228, 171) Image.Placement = xlMoveAndSize
Pour celà, je pourrais utiliser ce code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 Worksheets("fichesdetail").Pictures.Insert(chemin & ":photos:" & prefixe & numphoto & ".jpg").Select If (Selection.Height < Selection.Width) Then 'photo paysage With Selection .ShapeRange.Left = Cells(lfiche + 2, 7).Left + 1.5 .ShapeRange.Top = Cells(lfiche + 2, 7).Top + 40 .Width = 228 End With Else With Selection 'photo portrait .ShapeRange.Left = Cells(lfiche + 2, 7).Left + 40 .ShapeRange.Top = Cells(lfiche + 2, 7).Top + 1 .Height = 230 End With End If Selection.Placement = xlMoveAndSize
Toutefois, ce deuxième bout de code ne me permet pas de délier le fichier image du fichier excel (je ne peux donc pas déplacer mon fichier excel)
Comment puis-je faire pour délier l'image tout en différenciant les images portrait des images paysage ?
Merci d'avance,
Aurore
Partager