Re : Insertion image dans une feuille sans l'intéger au fichier xls
Bonsoir !
Il n'y a rien a faire, je n'arrive plus à faire planter la macro !
(je rigole, ce n'était pas le but !)
C'est génial, merci !
Je remets le code complet ci dessous pour faciliter la tâche si quelqu'un d'autre est intéresse par la suite.
Encore merci,
Vinc.
--------------
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim FS
Set FS = CreateObject("Scripting.FileSystemObject")
If FS.FileExists([A1]) = False Then
MsgBox "Chemin absent ou image introuvable à l'endroit défini"
Exit Sub
End If
Application.ScreenUpdating = False
Range("J9").Select
Pos1 = Range("J9").Left
Pos2 = Range("J9").Top
ActiveSheet.Shapes.AddShape(msoShapeRectangle, 180, 180, 180, 180).Select
Selection.Left = Pos1
Selection.Top = Pos2
Selection.Name = "Image"
Selection.ShapeRange.Fill.Visible = msoFalse
Selection.ShapeRange.Line.Visible = msoFalse
Selection.ShapeRange.Fill.UserPicture [A1]
Range("J9").Select
Application.ScreenUpdating = True
End Sub
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Dim ws As Worksheet
Dim shape As shape
Range("A1").Select
If ActiveCell = "" Then Exit Sub
Set ws = Sh
On Error Resume Next
ws.Shapes("Image").Delete
End Sub