共有两种方法,需要自动运行就用过程函数auto_open()
Sub Auto_Open()
' Select the image you want to remove the background from
Dim selectedImage As Shape
Set selectedImage = ActiveSheet.Shapes("Picture 1") ' Set the transparent color of the image
With selectedImage.PictureFormat
.TransparentBackground = msoTrue
.TransparencyColor = RGB(255, 255, 255)
End With
Set selectedImage = ActiveSheet.Shapes("Picture 2") ' Set the transparent color of the image
With selectedImage.PictureFormat
.TransparentBackground = msoTrue
.TransparencyColor = RGB(255, 255, 255)
End With
Dim selectedPicture As Picture
Set selectedPicture = ActiveSheet.Pictures("Picture 3")
' Set the transparent color of the picture
With selectedPicture.ShapeRange.PictureFormat
.TransparentBackground = True
.TransparencyColor = RGB(255, 255, 255)
End With
End Sub