excel-2007格式的vb代码->重新着色->设置透明颜色

发布于 2024-07-30 07:25:54 字数 133 浏览 3 评论 0原文

您好,您可以显示 excel-2007 格式的 vb 代码吗 -> 重新着色 -> 设置透明颜色 在插入的图像上...

顺便说一句,忘记提及 excel-2007 记录宏不会记录这些东西,否则我不会在这里问它...:)

hi can you show a vb code for excel-2007 format->recolor->set transparent color
on an a image inserted...

by the way, forgot to mention that excel-2007 record macro does not record this stuff otherwise i would not ask it here... :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

百变从容 2024-08-06 07:25:54

好的,这是我在 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

OK, here is a Macro that I wrote in Excel 2007 that works:

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
从﹋此江山别 2024-08-06 07:25:54

我在 Excel 2003 中记录了一个宏,这就是我得到的:

Selection.ShapeRange.PictureFormat.TransparentBackground = msoTrue
Selection.ShapeRange.PictureFormat.TransparencyColor = RGB(5, 95, 209)
Selection.ShapeRange.Fill.Visible = msoFalse

我认为这也适用于 Excel 2007,因为一切都倾向于向前兼容。

I recorded a macro in Excel 2003, and this is what I got:

Selection.ShapeRange.PictureFormat.TransparentBackground = msoTrue
Selection.ShapeRange.PictureFormat.TransparencyColor = RGB(5, 95, 209)
Selection.ShapeRange.Fill.Visible = msoFalse

I think this will work in Excel 2007 also, since everything tends to be forwards-compatible.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文