comment puis-je afficher une photo par son nom

ExcelDZ

XLDnaute Junior
Bonjour,
comment puis-je afficher une photo par son nom
 

Pièces jointes

  • Katib-5462.xlsx
    17.4 KB · Affichages: 33

Lone-wolf

XLDnaute Barbatruc
Re : comment puis-je afficher une photo par son nom

Bonjour katib,

Code à modifier selon ton choix.


Code:
Dim sh, img, repertoire, nf

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False

 suppression
  repertoire = "D:\Dossiers Excel\Importation Images\" 'Répertoire à modifier
    nf = repertoire & Range("B3") & ".jpg"  'En B3 le nom de l'image
   
    On Error Resume Next
      With Range("B3")
    If Dir(nf) <> "" Then
      Set img = ActiveSheet.Pictures.Insert(nf)
      img.Name = .Value
      img.Top = .Top
      img.Left = .Left
    End If
Range("B2").Value = .Value
End With
Application.EnableEvents = True
End Sub


Sub suppression()
  For Each sh In ActiveSheet.Shapes
    If sh.Type <> 8 Then sh.Delete
  Next sh
End Sub


A+ :cool:
 

Discussions similaires

Réponses
12
Affichages
441

Statistiques des forums

Discussions
312 195
Messages
2 086 075
Membres
103 111
dernier inscrit
Eric68350