Name photo As Range("Tableau!B2").Value & "PseudoACC" & Range("A3").Value & B & ".jpg"
Dim Str As String Str = Range("Tableau!B2").Value & "PseudoACC" & Range("A3").Value & B & ".jpg" MsgBox "renomer en: " & Str Name photo As Str
Name "c:\repertoire\ton_fichier.jpg" as "c:\repertoire\ton_fichier_renommé.jpg"
Name photo As Range("Tableau!B2").Value & "PseudoACC" & Range("A3").Value & B & ".jpg"
Name photo As Chemin & "" & Range("Tableau!B2").Value & "PseudoACC" & Range("A3").Value & B & ".jpg"
Chemin = Fso.GetFile(photo).ParentFolder
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionSub Inserer_image() Application.ScreenUpdating = False Dim photo As String Dim Chemin As String Dim Fso As Object Dim A As Integer A = Range("J1").Value Dim B As Integer B = Range("J1").Value + 1 Dim x As Range, s As String s = [A2] Set x = Sheets("Tableau").Range("A:A").Find(s, , xlValues, xlWhole, , , False) photo = Application.GetOpenFilename("Image Files (*.jpg;*.jpeg;*.bmp;*.gif;*.png;*.tif), *.jpg;*.jpeg;*.bmp;*.gif;*.png;*.tif", 2, "Open Image files", True) If photo = "Faux" Then Exit Sub Set Fso = CreateObject("Scripting.FileSystemObject") Chemin = Fso.GetFile(photo).ParentFolder Dim Chemin_complet As String Chemin_complet = Chemin & "" & Range("Tableau!B2").Value & "PseudoACC" & Range("A3").Value & B & ".jpg" Name photo As Chemin_complet Sheets("Tableau").Cells(x.Row, 45 + B).Value = Sheets("Tableau").Range("B2") & Sheets("Tableau").Cells(x.Row, 37).Value & B Range("A12").Select ActiveSheet.Pictures.Insert(Chemin_complet).Select With Selection .ShapeRange.Left = ActiveCell.Left .ShapeRange.Top = ActiveCell.Top .Height = 178.5 .Width = 269.25 End With Range("J1") = A + 1 Call rangephoto Application.ScreenUpdating = True End Sub Sub rangephoto() 'Selection. = 178.5 'Selection.ShapeRange.Width = 269.25 CommandBars("Picture").FindControl(ID:=6382).Execute End Sub
Sub Inserer_image() Application.ScreenUpdating = False Dim photo As String Dim Chemin As String Dim Fso As Object Dim A As Integer A = Range("J1").Value Dim B As Integer B = Range("J1").Value + 1 Dim x As Range, s As String s = [A2] Set x = Sheets("Tableau").Range("A:A").Find(s, , xlValues, xlWhole, , , False) photo = Application.GetOpenFilename("Image Files (*.jpg;*.jpeg;*.bmp;*.gif;*.png;*.tif), *.jpg;*.jpeg;*.bmp;*.gif;*.png;*.tif", 2, "Open Image files", True) If photo = "Faux" Then Exit Sub Set Fso = CreateObject("Scripting.FileSystemObject") Chemin = Fso.GetFile(photo).ParentFolder Dim Chemin_complet As String Chemin_complet = Chemin & "" & Range("Tableau!B2").Value & "PseudoACC" & Range("A3").Value & B & ".jpg" Name photo As Chemin_complet Sheets("Tableau").Cells(x.Row, 45 + B).Value = Sheets("Tableau").Range("B2") & Sheets("Tableau").Cells(x.Row, 37).Value & B Range("A12").Select ActiveSheet.Pictures.Insert(Chemin_complet).Select With Selection .ShapeRange.Left = ActiveCell.Left .ShapeRange.Top = ActiveCell.Top .Height = 178.5 .Width = 269.25 End With Range("J1") = A + 1 Call rangephoto Application.ScreenUpdating = True End Sub Sub rangephoto() 'Selection. = 178.5 'Selection.ShapeRange.Width = 269.25 CommandBars("Picture").FindControl(ID:=6382).Execute End Sub