Author Topic: Exclude Connectors  (Read 4076 times)

0 Members and 1 Guest are viewing this topic.

longo93

  • Jr. Member
  • **
  • Posts: 44
Exclude Connectors
« on: June 21, 2016, 03:36:55 AM »
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

  • Hero Member
  • *****
  • Posts: 1803
    • ShapeSheet™ Knowledge Base
Re: Exclude Connectors
« Reply #1 on: June 21, 2016, 04:19:58 AM »
what are you mean as connector ?

longo93

  • Jr. Member
  • **
  • Posts: 44
Re: Exclude Connectors
« Reply #2 on: June 21, 2016, 04:29:56 AM »
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

  • Hero Member
  • *****
  • Posts: 1803
    • ShapeSheet™ Knowledge Base
Re: Exclude Connectors
« Reply #3 on: June 21, 2016, 04:32:15 AM »
you mean dynamic connectors ?

longo93

  • Jr. Member
  • **
  • Posts: 44
Re: Exclude Connectors
« Reply #4 on: June 21, 2016, 04:38:37 AM »
yes dynamic connectors, sorry ^^

metuemre

  • Full Member
  • ***
  • Posts: 178
Re: Exclude Connectors
« Reply #5 on: June 21, 2016, 04:45:02 AM »
You need to check if the shape is 1D or 2D. Please see the sample code below

Code
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

  • Hero Member
  • *****
  • Posts: 1803
    • ShapeSheet™ Knowledge Base
Re: Exclude Connectors
« Reply #6 on: June 21, 2016, 04:48:27 AM »
try also
Code
Dim sh As Shape
Set sh = ActiveWindow.Selection.PrimaryItem
If sh.Master = "Dynamic connector" Then ' exclude that shape

longo93

  • Jr. Member
  • **
  • Posts: 44
Re: Exclude Connectors
« Reply #7 on: June 21, 2016, 05:00:23 AM »
Thanks for your replies. Well i tried

Code
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

  • Jr. Member
  • **
  • Posts: 44
Re: Exclude Connectors
« Reply #8 on: June 21, 2016, 05:14:20 AM »
Got it, thanks guys :)