View Single Post
 
Old 06-17-2019, 05:50 PM
Shan Shan is offline Windows 10 Office 2016
Novice
 
Join Date: Jun 2019
Posts: 1
Shan is on a distinguished road
Default Selecting particular Object types with VBA

Hi all,

I am trying to select a particular object type in Visio. I have got some code that seems to do this however when I select the object I want / Which is a cube box kind of graphic(still a shape from the standard templates), it does not work.

Any ideas to what I am doing wrong with my code?

Code:
 
Sub SelectSimilarShapesByMaster()
    If ActiveWindow.Selection.Count = 0 Then Exit Sub
    Dim SelShp As Visio.Shape
    Set SelShp = ActiveWindow.Selection(1)
    If SelShp.Master Is Nothing Then Exit Sub
    ActiveWindow.DeselectAll
    Dim CheckShp As Visio.Shape
    For Each CheckShp In ActivePage.Shapes
        If Not CheckShp.Master Is Nothing Then
            If CheckShp.Master = SelShp.Master Then
                ActiveWindow.Select CheckShp, visSelect
            End If
        End If
    Next CheckShp
End Sub

Thanks
Reply With Quote