是否有一种使用VBA脚本对图像应用一些透明效果的方法?我已经录制了一个“宏”,但艺术效果并没有被记录下来。我已经找到了如何为形状创建透明度,但对于图像还没有找到。
.ShapeRange.Fill.UserPicture
将您的实际图片嵌入矩形中.ShapeRange.Fill.Transparency
调整透明度Sub RemoveBackground()
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
Sub RemoveShapes()
' Select the image you want to remove the background from
Dim selectedImage As Shape
Set selectedImage = ActiveSheet.Shapes("Image1") ' Set the transparent color of the image
With selectedImage.PictureFormat
.TransparentBackground = msoTrue
.TransparencyColor = RGB(255, 255, 255)
End With
End Sub