Exclude Connectors

Started by longo93, June 21, 2016, 08:36:55 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

longo93

Hey there,

i have written a vba code to export shape datas from visio to an excel file. its working pretty well. now i want to exclude all connectors i have used in my visio flow chart. my idea was something like ...

dim connector as "connectors"
....

If connector = "connectors"
         " do nothing with my excel file"

do u have any idea how can i select just the connector ?


Surrogate

what are you mean as connector ?

longo93

I mean the lines between the shapes, my code recognizes that connector lines as a shape without data and produce a blank line in my excel file

Surrogate

you mean dynamic connectors ?

longo93

yes dynamic connectors, sorry ^^

metuemre

You need to check if the shape is 1D or 2D. Please see the sample code below

Private Sub Trial()
    For Each shp In ActivePage.Shapes
        If shp.OneD Then
        GoTo NextShp
        Else
        'Do your stuff like export to excel, etc.
        End If
NextShp:
    Next shp
End Sub

Surrogate

try also
Dim sh As Shape
Set sh = ActiveWindow.Selection.PrimaryItem
If sh.Master = "Dynamic connector" Then ' exclude that shape

longo93

Thanks for your replies. Well i tried

For Each shp In ActivePage.Shapes
    If shp.OneD Then
        GoTo Nextshp
    Else
    i = i + 1

    blatt.Cells(i, 1).Value = shp.Cells("prop.ShapeNumber").Formula
    blatt.Cells(i, 2).Value = shp.Cells("prop.NameDE").ResultStr("")
     If shp.CellExists("prop.Typ", True) Then
        blatt.Cells(i, 3).Value = shp.Cells("prop.Typ").ResultStr("")
    Else
        blatt.Cells(i, 3).Value = ""
    End If
    End If


But this is not working cause of that "GoTo Nextshp"

longo93