Bonjour à tous,
Voilà j'essaye d'importer une image stocké dans mes document.
Voici mon problème, quand je lance la macro, le fichier Excel s'ouvre mais l'image n'est pas importé.
Voici mon code ci dessous, j'obtiens une erreur sur l'insertion de l'image. (' Run-time error '424' Object required)
Si quelqu'un a une idée, je vous remercie par avance
'## Création Excel
Set oExcel = CreateObject("Excel.Application")
If Err.Number <> 0 Then
Set oExcel = CreateObject("Excel.Application")
oExcel.Visible = True
End If
oExcel.Visible = True
Set oBook = oExcel.Workbooks.Open("C:\Users\bt\Desktop\excel.xls")
Set wbks = oExcel.ActiveWorkbook
Set oSheet = oBook.ActiveSheet
'## Import the picture into the Excel file
-------------------------------------------------------------------------------------------------
ActiveSheet.pictures.Insert("C:\Temp\Image.JPG").Select
(' Run-time error '424' Object required)[/color]
--------------------------------------------------------------------------------------------------
'Position the picture into the file
With Selection
.Left = sheet.Range("C40").Left
.Top = oSheet.Range("C40").Top
End With
'## Display the Excel
oExcel.Visible = True