Visio - Connecting Shapes Automatically

Asked By BenMc
01-May-08 08:55 AM
Hi Everyone,

I'm trying to get Visio to connect shapes automatically. The process should
be that Visio examines the 'Connected to' field of the shape, locates the
shapes in the drawing listed in this field using their Asset Number, then
draws connecting lines between the shape and it's children. So for example,
it would look at a Switch, recognise that 3 servers are connected to it,
locate these servers on the drawing, then add the connectors.

Does anyone have any ideas how this could be done? I'm thinking it's going
to be a bit of VBA, but my knowledge is limited. My eventual plan is to run a
database update, add the new shapes based on the Access records, then
automatically link and layout the shapes to produce a Network Toplogy diagram.

I'm sure it's possible, but I need advice from experts to help me out!

Thanks in advance,
Ben
Visio 2007
(1)
Visio 2003
(1)
VBA
(1)
FindMySubordinates
(1)
Database
(1)
BenMcD
(1)
FoundShapes
(1)
Parkers
(1)
  Al Edlund replied...
01-May-08 12:00 PM
The easy first step is to get David Parkers book on data visualization. He
has some examples on how to do the visio portion of it. The pre-req in this
case if v2007 Pro for data linking. I usually strongly suggest that the user
consider using o2007 pro as well  even though a2007 isn't required. The
skill set would be medium to strong vb(a) skills with some knowledge of
database.
If you need more help come on back,

al
  BenMc replied...
02-May-08 07:36 AM
Thanks for that Al, I'll do some googling and try and order a copy of the
book. Can this be done in any version of 2003? My organisation doesn't have
2007 at the moment, but I can get a copy of it if it can't be done in 2003.
  David Parker replied...
02-May-08 08:30 AM
The book is aimed at Visio 2007, but roughly half is applicable to Visio
2003.
The connections example could be adapted to read any recordset, or the
custom properties (which could be refreshed using the database wizard)



--
David Parker
Microsoft MVP (Visio)
http://bvisual.spaces.live.com
http://www.visualizinginformation.com
  BenMc replied...
06-May-08 04:46 AM
Sounds like exactly what I need! Just to make it clear:

Each of the component items within my DB are related to different service
areas within my organisation. I could use the database wizard to monitor the
table and add the shapes automatically, copying the record details into the
relevant custom property fields. Within a new custom property, each item
would have the asset tag of the other equipment it's linked to- could Visio
monitor this field, identify the asset tag of the related items, find the
related items, and draw the links between them?

Hopefully then it would be a case of setting Visio to auto-arrange the
shapes into a tree based layout.

Does this sound 'do-able'?
  David Parker replied...
09-May-08 03:03 AM
Yes, with code, of course


--
David Parker
Microsoft MVP (Visio)
http://bvisual.spaces.live.com
http://www.visualizinginformation.com
  BenMc replied...
27-May-08 06:18 AM
David,

I've bought your book and have been working my way through it. Very good
read, there's so much I didn't realise you could do with Visio!

I've started coding to get the shapes to link automatically, I'm modifying
the 'Connect my Subordinates' section to suit my needs. When I run it in it's
standard form, it displays the following error:

Type mismatch: array or user-defined type expected"

The particular line is:
If FindMySubordinates(manager, foundShapes) = True Then

I'm not too sure where to go from here, any suggestions?

Thank you,
Ben
  BenMc replied...
27-May-08 12:06 PM
No problems, I've sorted it now.

I've managed to get it linking the shapes, I'm now working on getting it to
link to more than one parent, by examining the list from the field, for
example:


Hoping this is possible!
  David Parker replied...
28-May-08 12:48 PM
Glad you like the book ... shame it could not be in color!


--
David Parker
Microsoft MVP (Visio)
http://bvisual.spaces.live.com
http://www.visualizinginformation.com
  BenMc replied...
10-Jul-08 09:41 AM
True, but the book is just fine in plain black and white to be honest, simple
and easy to read that way!

Unforunately I'm back to ask your advice again- I've cracked getting Visio
to link shapes. It looks at the particular shape, examines a field called
'Parent', takes the name of the parent, locates it then connects the two
together. I can't seem to work out how to get it to connect a shape to
mutliple parents!

My parent field would be as follows:
Parent - SERVER1, SERVER 2, SERVER3

Each entity is followed by a comma and seperated by a space. How do I go
about modifying the code so that it can connect to multiple parents? I can
send the code if required?

Any advice/help you can provide would be greatly appreciated as I've been
struggling for some time!

Thanks again,
Ben
Create New Account
help
Visio drawing created in V.2003 loses data in V.2007 Visio I have a user who created a Visio drawing with Visio 2003 however when another user opens the drawing with Visio 2007, after the organizational chart opens, it loses data and gets extra boxes in the
Visio x Visio viewer Visio I need test visio viewer in my machine, but i've visio 2007 and when i'll open a visio drawing in IE, it'd open in ViSIO. How a can do this ??? run a visio drawing in a visio viewer Another question
Create ERD in Visio]Reverse engineer wizard can't create a datasource from Excel Visio I'm trying to create an ERD in Visio from exported tables from MySQL. I exported each table to Excel. I am on Windows XP 2002 Professional. I have Visio Professional 2007. I have Excel 2007. In the reverse engineer dialog box it looks like it accepts Excel 97-2000? In I don't open them it should work. When I get to the Select Workbook Database Name dialog and select the sheet it gives me the error "external table is not expected format". This occurs even though I have the sheet saved both as Excel2003or Excel 2007. How can I get Visio to connect to the Excel data source? I have "generic
Database model locks up Visio I have Visio 2003. When I try to load a new Database Model Diagram, Visio locks up every time. I am running XP Professional x64. Is there isomething I am missing? Thanks for any information. Visio Discussions Visio (1) Vista (1) XP (1) Windows Server (1) Database (1) _NextPart_ (1) DB (1) WinXP
Visio 2003 file read by Visio 2002 Visio My Visio 2002 does not open Visio 2003 file. Visio 2003 Viewer does not work either! What do I need to do to open / view