Bonjour voici le code qui me fait perdre du temps depuis 3 jours...
en passant sur office 2019, j'ai dû remplacer la fonction INSERT par ADDPICTURE et depuis la fameuse run-time error 1004 apparait avec "value is out of range"... quand je lance la "watch expression" elle ne veut pas prendre la partie gras du code qui pose probleme... help !
Sub ButtonInsertPics()
On Error GoTo 0
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.Filters.Clear
.Filters.Add "Picture Files", "*.jpg;*.png"
.ButtonName = "Select the photo"
.AllowMultiSelect = False
.Title = "Choose the photo"
.InitialView = msoFileDialogViewDetails
If .Show = -1 Then
MsgBox ("Photo chosen is :" & .SelectedItems(1))
Else
Exit Sub
End If
End With
ActiveCell.Select
ActiveSheet.Shapes.AddPicture Filename:=fd.SelectedItems(1), _
linktofile:=msoFalse, _
savewithdocument:=msoTrue, _
Left:=ActiveCell.Left, _
Top:=ActiveCell.Top, _
Width:=ActiveCell.Width, _
Height:=ActiveCell.Height
End Sub