Visio create a macro for searching and to mark shapes

Started by oli0585, November 22, 2017, 01:02:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

oli0585

Hello everybody,

[img]C:\Users\oezgan\Desktop\index.jpg [img]
I would like to search in the rectangle (shape) for values ".100.03" in the visio sheet and mark the ".100.03" shapes containing the same values and group them into a single shape ".100.03". A macro should be created so that only the contents of the rectangles are searched and marked or grouped. Shape names and shape data were also awarded. I'm asking for your help.

How can I insert a picture here in forum? I have a photo for this problem.

Thank you in advance.

oli0585

#1
Quote from: oli0585 on November 22, 2017, 01:02:22 PM
Hello everybody,

[img]C:\Users\oezgan\Desktop\index.jpg [img]
I would like to search in the rectangle (shape) for values ".100.03" in the visio sheet and mark the ".100.03" shapes containing the same values and group them into a single shape ".100.03". A macro should be created so that only the contents of the rectangles are searched and marked or grouped. Shape names and shape data were also awarded. I'm asking for your help.

How can I insert a picture here in forum? I have a photo for this problem.

Thank you in advance.

Yacine

Hallo Oli,
could you please reformulate your question. It is not clear what you want to do.
Gruß,
Y.
Yacine

oli0585

I want to creat a makro code.
I've created oval-shaped and rectangle shapes, and numbers like PD.111.10, PI.112.20 are in these shapes. Now, I'd like to compare this numbers in rectangular shapes with oval-shapes and the same numbers should be marked and  grouped.
I have also given names and defined shape data to the rectangular and oval-shaped shapes, perhaps it could be easier to search and find using macro.

I'm asking for your help.
Thanks.

In german again  ;) :)
Hallo zusammen,

ich brauche eure Hilfe dringend.

ich habe oval-förmige und Rechteck-förmige shapes erstellt und in diesen Shapes stehen Zahlen wie PD.111.10, PI.112.20 etc. Nun möchte ich diese Werte im Rechteckigen-Shapes enthaltene Zahlen in Oval-förmigen shapes vergleichen bzw. durchsuchen und die gleichen Zahlen enthaltene oval-förmige Shapes markieren und in eine einzige Baugruppe gruppieren.
Zu den rechteckige und oval-förmige shapes habe ich auch Namen vergeben und auch auch shape-daten definiert, vielleicht könnte man leichter suchen und finden mithilfe von Makro.
Ich würde gerne ein Bild dazu einfügen aber geht hier garnicht leider.
Ich bitte um eure Hilfe.

Danke im Voraus!

Yacine

Hallo Oli,
it is obviously not a language issue, but a Visio one.
The thing that disturbed me, is the fact that you want to group the shapes belonging to a same category. Well, this may make sense in your special case. ??? Actually there should be other possibilities to handle such groups (layers?)

By "comparing", you probably mean to find all shapes having the same value in a field?

your code should look somewhat like:

Sub callGroup()
    groupSimilarShapes "prop.UGR", "100"
End Sub

Sub groupSimilarShapes(cellName As String, val As String)
Dim shp As Shape
    ActiveWindow.DeselectAll
    For Each shp In ActivePage.Shapes
        If shp.CellExists(cellName, visExistsAnywhere) Then
            If shp.Cells(cellName).ResultStr("") = val Then
                ActiveWindow.Select shp, visSelect
            End If
        End If
    Next shp
    ActiveWindow.Selection.Group
End Sub
Yacine