Bonjour,
J'ai pompé sur le net une macro qui insère des images, elle est super, mais je ne sais pas comment faire pour mettre une bordure rouge autour des images. Il faudrait que la bordure se mette dans chaque feuille quand on clique sur l'icone de la macro qui est sur le ruban. voila la macro, alors si quelqu'un peut la compléter, ca serait super.
Option Explicit
Dim pos As String
Sub InsererImage()
Dim myPicture As String, MyRange As Range
myPicture = Application.GetOpenFilename _
("Pictures (.bmp; .gif; .jpg; .png; .tif),.bmp; .gif; .jpg; .png; .tif", _
, "Select Picture to Import")
Set MyRange = Selection
InsertAndSizePic MyRange, myPicture
With ActiveSheet.Range(pos)
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End With
End Sub
Sub InsertAndSizePic(Target As Range, PicPath As String)
Dim p As Picture
Application.ScreenUpdating = False
On Error GoTo EndOfSubroutine:
Set p = ActiveSheet.Pictures.Insert(PicPath)
If Target.Cells.Count = 1 Then Set Target = Target.MergeArea
pos = Target.Address
With Target
p.Top = .Top
p.Left = .Left
p.Width = .Width
p.Height = .Height
End With
EndOfSubroutine:
End Sub
A+ Maxou
Partager