C
celtic_kiwi
I am a VBA hack and have tried off this group, Visio help, and MSDN to
meet my seemingly simple requirements. I apologise if this is a no
brainer for you but it has me confused.
I have a business process diagram, well lots of them really, with
rectangles, decision points an some other boxes on them.
Each shape has one or more connectors/lines running between.
All I want is to produce a list similar to the following:
ShapeID, ShapeText, LinkDir, LinkTo, LinkText
ShapeID is the shape.id
ShapeText is shape.text
LinkDir is the direction of the link (Out/in)
LinkTo is the Shape.id of the connected rectangle, Decision, etc
LinkText is the shape.text for the line/connector running between
I do not need to know how the connection connects to either shape,
just that it does
I can clean up any line breaks in the Text property myself
I hacked together the following from the sources listed above but just
cant get the output I want
All help much appreciated.
Public Sub ToPart_Example()
Dim vsoShapes As Visio.Shapes
Dim vsoShape As Visio.Shape
Dim vsoConnectTo As Visio.Shape
Dim intToData As Integer
Dim strTo As String
Dim vsoConnects As Visio.Connects
Dim vsoConnect As Visio.Connect
Dim intCurrentShapeID As Integer
Dim intCounter As Integer
Set vsoShapes = ActivePage.Shapes
'For each shape on the page, get its connections.
For intCurrentShapeID = 1 To vsoShapes.Count
Set vsoShape = vsoShapes(intCurrentShapeID)
Set vsoConnects = vsoShape.Connects
'For each connection, get the shape it connects to
'and the part of the shape it connects to,
'and print that information in the Immediate window.
For intCounter = 1 To vsoConnects.Count
Set vsoConnect = vsoConnects(intCounter)
Set vsoConnectTo = vsoConnect.ToSheet
intToData = vsoConnect.toPart
'Print the name and part of the shape the
'Connect object connects to.
Debug.Print vsoShape.ID & "|" & vsoShape.ObjectType & "|" &
vsoShape.Name & "|" & vsoShape.Text & "|To|" & vsoConnectTo.ID & "|" &
vsoConnectTbjectType & "|" & vsoConnectTo.Name & "|" &
vsoConnectTo.Text & "||"
Next intCounter
Next intCurrentShapeID
End Sub
meet my seemingly simple requirements. I apologise if this is a no
brainer for you but it has me confused.
I have a business process diagram, well lots of them really, with
rectangles, decision points an some other boxes on them.
Each shape has one or more connectors/lines running between.
All I want is to produce a list similar to the following:
ShapeID, ShapeText, LinkDir, LinkTo, LinkText
ShapeID is the shape.id
ShapeText is shape.text
LinkDir is the direction of the link (Out/in)
LinkTo is the Shape.id of the connected rectangle, Decision, etc
LinkText is the shape.text for the line/connector running between
I do not need to know how the connection connects to either shape,
just that it does
I can clean up any line breaks in the Text property myself
I hacked together the following from the sources listed above but just
cant get the output I want
All help much appreciated.
Public Sub ToPart_Example()
Dim vsoShapes As Visio.Shapes
Dim vsoShape As Visio.Shape
Dim vsoConnectTo As Visio.Shape
Dim intToData As Integer
Dim strTo As String
Dim vsoConnects As Visio.Connects
Dim vsoConnect As Visio.Connect
Dim intCurrentShapeID As Integer
Dim intCounter As Integer
Set vsoShapes = ActivePage.Shapes
'For each shape on the page, get its connections.
For intCurrentShapeID = 1 To vsoShapes.Count
Set vsoShape = vsoShapes(intCurrentShapeID)
Set vsoConnects = vsoShape.Connects
'For each connection, get the shape it connects to
'and the part of the shape it connects to,
'and print that information in the Immediate window.
For intCounter = 1 To vsoConnects.Count
Set vsoConnect = vsoConnects(intCounter)
Set vsoConnectTo = vsoConnect.ToSheet
intToData = vsoConnect.toPart
'Print the name and part of the shape the
'Connect object connects to.
Debug.Print vsoShape.ID & "|" & vsoShape.ObjectType & "|" &
vsoShape.Name & "|" & vsoShape.Text & "|To|" & vsoConnectTo.ID & "|" &
vsoConnectTbjectType & "|" & vsoConnectTo.Name & "|" &
vsoConnectTo.Text & "||"
Next intCounter
Next intCurrentShapeID
End Sub