Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dynamic Connector using VBA

931 views
Skip to first unread message

Amit Jindal

unread,
Apr 9, 2003, 6:54:16 AM4/9/03
to
I am new to development in Visio using VBA. We have an application in which
we generate a XML file representing the Visio diagram.

Now we want to generate the graph using the XML file. But the problem is
that we don't have dynamic Connector in our Stencil.

Previously we used the connector on the Standard Toolbar.

How can we connect the shapes through our VBA code

regards
AMIT

Zack Moore

unread,
Apr 9, 2003, 2:33:29 PM4/9/03
to
Hi Amit,

Here are a couple of VBA macros that may help.

1) Drop a connector object on the active page.

Sub DropTheInternalConnector()

' Connector Shape handle
Dim vsoShape As Visio.Shape
Set vsoShape =
ActivePage.Drop(Visio.Application.ConnectorToolDataObject, 1, 4)

End Sub


2) Drop a couple rectangles and connect them.

Sub ConnectRectangles()

' need a couple shapes to connect.
Dim testShape1 As Visio.Shape
Dim testShape2 As Visio.Shape

' draw the shape object on the page
Set testShape1 = Visio.ActivePage.DrawRectangle(1, 1, 2, 2)
Set testShape2 = Visio.ActivePage.DrawRectangle(1, 9, 2, 10)

' define the selection object we will use to connect em.
Dim testSelection As Visio.Selection

' select the shapes via the selection object
Set testSelection = Visio.ActivePage.CreateSelection(visSelTypeAll)

' connect em all
testSelection.ConnectShapes

End Sub

Hope this helps.

--
Zack Moore
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.

"Amit Jindal" <amit_...@pspl.co.in> wrote in message
news:eezUfZo$CHA....@TK2MSFTNGP10.phx.gbl...

Amit Jindal

unread,
Apr 10, 2003, 2:39:37 AM4/10/03
to
Hi Zack,

The macros you have provided don't work.

1)Visio.Application doesn't have any ConnectorToolDataObject object. I tried
getting a reference to the Toolbar Connector but somehow I don't seem to get
it right.

2)Similarly Visio.ActivePage doesn't have any CreateSelection method.
Moreover this macro seems to select all the shapes and then connect them,
which is not the functionality that I desired

I am working on Visio 2000 SR1.

Thanks anyway.

AMIT

"Zack Moore" <za...@Online.Microsoft.com> wrote in message
news:eGtxEas$CHA....@TK2MSFTNGP11.phx.gbl...

Mike

unread,
Apr 24, 2003, 8:20:14 PM4/24/03
to
You could always create your own connector as a piece of
masters and retrieve whenever you need an instance of it,
right?

Mike

>.
>

0 new messages