VBA - Inserter une image avec rotation et positionnement
Résolu
Bendit0044
-
cs_Le Pivert Messages postés 7904 Date d'inscription Statut Contributeur Dernière intervention -
cs_Le Pivert Messages postés 7904 Date d'inscription Statut Contributeur Dernière intervention -
A voir également:
- VBA - Inserter une image avec rotation et positionnement
- Rotation ecran windows - Guide
- Rotation video - Guide
- Image iso - Guide
- Légender une image - Guide
- Acronis true image - Télécharger - Sauvegarde
5 réponses
Bonjour
Il suffit de décaler l'image après la rotation
A essayer et à adapter avec les bonnes valeurs
Cdlt
Il suffit de décaler l'image après la rotation
Application.Dialogs(xlDialogInsertPicture).Show Set Emplacement = Range("B7:F45") Selection.Left = Emplacement.Left Selection.Top = Emplacement.Top Selection.Height = Emplacement.Height Selection.Width = Emplacement.Width Selection.ShapeRange.IncrementRotation 90# Selection.Left = Emplacement.Left - 38 Selection.Top = Emplacement.Top + 38
A essayer et à adapter avec les bonnes valeurs
Cdlt
Bonjour,
Essaie ceci:
Essaie ceci:
Sub InsertionImageDevis_Plan_GM() Dim Emplacement As Range Dim I As Shape On Error GoTo fin: Application.Dialogs(xlDialogInsertPicture).Show Set Emplacement = Range("B7:F45") Selection.Left = Emplacement.Left - 10 Selection.Top = Emplacement.Top + 10 Selection.Height = Emplacement.Height Selection.Width = Emplacement.Width Selection.ShapeRange.IncrementRotation 90# Selection.Name = "Photo" Set I = Sheets("Feuil1").Shapes("Photo") I.Copy ActiveSheet.Shapes("Photo").Select Range("B7").Select ActiveSheet.Paste ActiveSheet.Shapes("Photo").Delete Exit Sub fin: If Err = 1004 Then MsgBox "Insertion d'image interrompue" End Sub
correction:
Sub InsertionImageDevis_Plan_GM() Dim Emplacement As Range Dim I As Shape On Error GoTo fin: Application.Dialogs(xlDialogInsertPicture).Show Set Emplacement = Range("B7:F45") Selection.Left = Emplacement.Left Selection.Top = Emplacement.Top Selection.Height = Emplacement.Height Selection.Width = Emplacement.Width Selection.ShapeRange.IncrementRotation 90# Selection.Name = "Photo" Set I = Sheets("Feuil1").Shapes("Photo") I.Copy ActiveSheet.Shapes("Photo").Select Range("B7").Select ActiveSheet.Paste ActiveSheet.Shapes("Photo").Delete Exit Sub fin: If Err = 1004 Then MsgBox "Insertion d'image interrompue" End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
Si tu veux mettre une autre image, il faudra supprimer celle qui s'y trouve déjà.
Voici le code:
Voici le code:
Sub InsertionImageDevis_Plan_GM() Dim Emplacement As Range Dim I As Shape On Error GoTo fin: For Each I In ActiveSheet.Shapes If I.Name = "Photo" Then I.Delete Next I Application.Dialogs(xlDialogInsertPicture).Show Set Emplacement = Range("B7:F45") Selection.Left = Emplacement.Left Selection.Top = Emplacement.Top Selection.Height = Emplacement.Height Selection.Width = Emplacement.Width Selection.ShapeRange.IncrementRotation 90# Selection.Name = "Photo" Set I = Sheets("Feuil1").Shapes("Photo") I.Copy ActiveSheet.Shapes("Photo").Select Range("B7").Select ActiveSheet.Paste ActiveSheet.Shapes("Photo").Delete Exit Sub fin: If Err = 1004 Then MsgBox "Insertion d'image interrompue" End Sub