We just upgraded to Excel 2010 from Excel 2003 and I have a code that worked on 03 but now doesn't entirely work on 2010. Basically in 03 it would remove the black background of the image, but on 2010 it does not. Here is the code I have:
I can do it manually by selecting the picture, then Picture Format - Colors - Set Transparency Color - then selecting the background color. But it does not record in the macro recorder so I can't even get an idea on it.
Code:
Sub InsertArrow()
On Error GoTo Error
ActiveSheet.Pictures.Insert( _
"S:\SERVICE\Repair Shop CDRs\CDR Templates\CDR Pictures\red arrow.bmp" _
).Select
With Selection.ShapeRange
.PictureFormat.TransparentBackground = msoTrue
.ScaleHeight 0.6, msoFalse
.ScaleWidth 0.32, msoFalse
.ZOrder msoBringToFront
.PictureFormat.IncrementBrightness 0.06
.PictureFormat.IncrementContrast 0.18
.Fill.Visible = msoFalse
End With
Exit Sub
Error: MsgBox "Red Arrow cannot be inserted.", vbOKOnly, "Error"
Exit Sub
End Sub
I can do it manually by selecting the picture, then Picture Format - Colors - Set Transparency Color - then selecting the background color. But it does not record in the macro recorder so I can't even get an idea on it.
Last edited: