Thev
Thev

Reputation: 1125

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

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?

Upvotes: 1

Views: 76

Answers (1)

barneyos
barneyos

Reputation: 586

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

Upvotes: 3

Related Questions