嗨,您可以显示excel-2007格式的vb代码 - > recolor->设置透明色 在插入的图像上...
顺便说一下,忘了提到excel-2007记录宏不记录这个东西,否则我不会在这里问它...... :)答案 0 :(得分:0)
我在Excel 2003中录制了一个宏,这就是我得到的:
Selection.ShapeRange.PictureFormat.TransparentBackground = msoTrue
Selection.ShapeRange.PictureFormat.TransparencyColor = RGB(5, 95, 209)
Selection.ShapeRange.Fill.Visible = msoFalse
我认为这也适用于Excel 2007,因为所有内容都往往是向前兼容的。
答案 1 :(得分:0)
好的,这是我在Excel 2007中编写的宏:
Sub Macro3()
Dim NewSheet As Worksheet, oldws As Worksheet
Set oldws = ActiveWorkbook.ActiveSheet
Dim i As Integer, obj As Shape
Dim picFmt As PictureFormat
Set NewSheet = Worksheets.Add
NewSheet.Range("A1").Value = oldws.Name
i = 3
NewSheet.Range("A2").Value = "Name"
NewSheet.Range("B2").Value = "Link Type"
For Each obj In oldws.Shapes
NewSheet.Cells(i, 1).Value = obj.Name
NewSheet.Cells(i, 2) = obj.Type
Set picFmt = obj.PictureFormat
With picFmt
NewSheet.Cells(i, 3) = .TransparencyColor
'set Black as the Transparent color'
.TransparencyColor = RGB(0, 0, 0)
End With
i = i + 1
Next
End Sub