Powerpoint VBA - How to store information 'within' shape?

懵懂的女人 提交于 2020-01-25 11:58:24

问题


Say I have the following code within a sub:

With square
        .Fill.ForeColor.RGB = RGB(255, 255, 255)
        .Fill.Transparency = 1
        .Name = "Foo"
End With

I can now define searches based on its .Name and even use that name within the code (for instance, I could set some String value to the name of the shape).

My question is - is there another way for me to store values 'within' a shape? Specifically, multiple Strings and Integers.

If no, when I am setting the text of a shape based on some String and Integer variables within a Sub, is there a way to allow a different Sub to use those bits of information?


回答1:


You may use square.tags collection - square.tags.Add "NAME",VALUE There is an example

With square
        .Fill.ForeColor.RGB = RGB(255, 255, 255)
        .Fill.Transparency = 1
        .Name = "Foo"
        .Tags.Add "Tag 1", 1
        .Tags.Add "Tag 2", 2
        ' Reading
        For a = 1 To .Tags.Count
            Debug.Print .Tags.Name(a), .Tags.Value(a)
        Next a
End With


来源:https://stackoverflow.com/questions/58552854/powerpoint-vba-how-to-store-information-within-shape

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!