Visio Data Modelling and VBA


2009-09-25 02:52




geodatabases, programming


IVMEEntity VisioModelingEngine shape visio entity vba uml





I use Visio for a number of tasks. For creating geodatabase models in ArcGIS, for system architecture diagrams, and for data flow models. It may not be the easiest program to use, but the alternatives are often too simplistic, or worse.

I wanted to generate a nice diagram of a SQL Server database I had

created, and automatically create hyperlinks that would pop up an Ajax box with sample records directly from the database. In order to do this each hyperlink had to have a variable based on the table/entity name. However it soon became apparent that there is no easy way to access the entity name in VBA from its associated shape object. The solution to this is the VisioModelingEngine library which provides access to the UML, but does not provide access to the shapes. |

There appears to be very little documentation on using the classes in this library. I found a couple of examples at and

My eventual workaround involves temporarily changing the first attribute in an entity to the entity name, searching through the shape’s text for this name, recording the ID and then changing it back. The idea was based on this post which hinted that was what they did, but then frustratingly didn’t post their solution.

Anyway the main use of the code is to associate a Visio entity (IVMEEntity) with its shape.

The full VBA code can be seen by clicking this link.

A good source of VBA scripts for Visio can be found at this provided me with the code for looping through shapes on a page.



1. Longred **

Awesome, but
1. How to call your script from OpenLayers?
2. Modification of results in a non functioning | Regards,


2. geographika **

1. The script is called by setting the URL of the WMS layer to the URL of the python script. E.g.

var wms = new OpenLayers.Layer.WMS(“My Layer Name”,””, {layers: “mylayer”});

2. Thanks for the info - not really needed to seed a cache as yet. You could always pass in a workingdir parameter, or hardcode it if you only have one cache.

Add Comment