GG24
GG24

Reputation: 303

Visio - How to store a shape in a temporary variable?

I tried this code to store an active shape to a temporary variable but I got a debug error, it said that shp is a "shape/shape" type and temp_variable is only a "shape" type but they are declared of the same type :

  Dim temp_variable as Visio.shape

    Dim shp As Visio.Shape
    Dim pagShape As Visio.Shape
        Set pagShape = Visio.ActivePage.PageSheet
        For Each shp In Visio.ActivePage.Shapes
           If condition = True Then 'some conditions about the shape
                  temp_variable = shp
            End If
        Next shp 

    'then I can work on temp_variable

    End Function

If you want to identify a shape and store it in a temp_variable how would you do it ? Thank you very much in advance

Upvotes: 0

Views: 65

Answers (1)

GG24
GG24

Reputation: 303

I just needed to use the key word SET :

Set temp_variable = shp

Upvotes: 1

Related Questions