S
Sachin
Hi everyone. I want to create a macro that takes currently selected
objects and somehow sets them (and their connectors and connected
shapes) apart from the rest of the drawing. I am familiar with these
two pieces of code from John Marshall's site:
----
Dim VsoSelect As Visio.Selection
Dim VsoShape as Visio.Shape
Set VsoSelect = Visio.ActiveWindow.Selection
If VsoSelect.Count > 0 Then
for each VsoShape in VsoSelect
next VsoShape
else
MsgBox "You Must Have Something Selected"
end if
---
Dim vsoShapes As Visio.Shapes
Dim vsoShape As Visio.Shape
Dim vsoConnectTo As Visio.Shape
Dim vsoConnects As Visio.Connects
Dim vsoConnect As Visio.Connect
Dim intCurrentShapeIndex As Integer
Dim intCounter As Integer
Set vsoShapes = ActivePage.Shapes
'For each shape on the page, get its connections.
For intCurrentShapeIndex = 1 To vsoShapes.Count
Set vsoShape = vsoShapes(intCurrentShapeIndex)
Set vsoConnects = vsoShape.Connects
'For each connection, get the shape it connects to.
For intCounter = 1 To vsoConnects.Count
Set vsoConnect = vsoConnects(intCounter)
Set vsoConnectTo = vsoConnect.ToSheet
'Print the name of the shape the
'Connect object connects to.
Debug.Print vsoConnectTo.Name
Next intCounter
Next intCurrentShapeIndex
---
I know that within these sub procedures lies my answer and I am trying
to combine them somehow. What made sense to me was to do this:
Set vsoSelect = Visio.ActiveWindow.selection
Set vsoShape = vsoSelect
Set vsoConnects = vsoShape.Connects
But it's giving me a type mismatch error. Does anyone have any other
ideas?
Thanks
objects and somehow sets them (and their connectors and connected
shapes) apart from the rest of the drawing. I am familiar with these
two pieces of code from John Marshall's site:
----
Dim VsoSelect As Visio.Selection
Dim VsoShape as Visio.Shape
Set VsoSelect = Visio.ActiveWindow.Selection
If VsoSelect.Count > 0 Then
for each VsoShape in VsoSelect
next VsoShape
else
MsgBox "You Must Have Something Selected"
end if
---
Dim vsoShapes As Visio.Shapes
Dim vsoShape As Visio.Shape
Dim vsoConnectTo As Visio.Shape
Dim vsoConnects As Visio.Connects
Dim vsoConnect As Visio.Connect
Dim intCurrentShapeIndex As Integer
Dim intCounter As Integer
Set vsoShapes = ActivePage.Shapes
'For each shape on the page, get its connections.
For intCurrentShapeIndex = 1 To vsoShapes.Count
Set vsoShape = vsoShapes(intCurrentShapeIndex)
Set vsoConnects = vsoShape.Connects
'For each connection, get the shape it connects to.
For intCounter = 1 To vsoConnects.Count
Set vsoConnect = vsoConnects(intCounter)
Set vsoConnectTo = vsoConnect.ToSheet
'Print the name of the shape the
'Connect object connects to.
Debug.Print vsoConnectTo.Name
Next intCounter
Next intCurrentShapeIndex
---
I know that within these sub procedures lies my answer and I am trying
to combine them somehow. What made sense to me was to do this:
Set vsoSelect = Visio.ActiveWindow.selection
Set vsoShape = vsoSelect
Set vsoConnects = vsoShape.Connects
But it's giving me a type mismatch error. Does anyone have any other
ideas?
Thanks