DonnaM » Visio


Visio and IA Tip – hide and show annotations

Wednesday, April 26th, 2006

Here’s my latest useful visio trick – a macro that hides and shows annotations on all sheets at once (it hides them for view and print). Very useful when you want to print everything with or without annotations. Label your annotation layer “annotation” or change the annotation to reflect what you usually call that layer.

Let me know if this is useful or if there is a better way of doing it ;)

Public Sub HideAnnotationLayers()
Dim layer As Visio.layer
Dim PageToIndex As Visio.Page
Dim curPage As Visio.Page
Dim layerObjVisCell As Cell
Dim layerObjPrintCell As Cell
Set curPage = ActivePage
For Each PageToIndex In ActiveDocument.Pages
ActiveWindow.Page = ActiveDocument.Pages(PageToIndex.Index).Name
For Each layer In Visio.ActivePage.Layers
If (layer.Name = "Annotation") Then
Set layerObjVisCell = layer.CellsC(visLayerVisible)
Set layerObjPrintCell = layer.CellsC(visLayerPrint)
layerObjVisCell.Formula = 0
layerObjPrintCell.Formula = 0
End If
ActiveWindow.Page = curPage
End Sub
Public Sub ShowAnnotationLayers()
Dim layer As Visio.layer
Dim PageToIndex As Visio.Page
Dim curPage As Visio.Page
Dim layerObjVisCell As Cell
Dim layerObjPrintCell As Cell
Set curPage = ActivePage
For Each PageToIndex In ActiveDocument.Pages
ActiveWindow.Page = ActiveDocument.Pages(PageToIndex.Index).Name
For Each layer In Visio.ActivePage.Layers
If (layer.Name = "Annotation") Then
Set layerObjVisCell = layer.CellsC(visLayerVisible)
Set layerObjPrintCell = layer.CellsC(visLayerPrint)
layerObjVisCell.Formula = 1
layerObjPrintCell.Formula = 1
End If
ActiveWindow.Page = curPage
End Sub

Connecting Visio to a database

Friday, July 29th, 2005

This post outlines how to connect your Visio diagram to a database to reduce manual entry of data and improve consistency. I’m sure there are plenty of ways to improve on this, but this is a low-tech method that works reasonably well.

Note: I am using my personal site for the examples, Visio Professional 2003 and Microsoft Access 2002. I haven’t tested on anything else – hopefully the instructions will help you to trouble-shoot other combinations.


I recently worked on a small project that was a little different to my previous IA projects. It involved a larger set of deliverables than normal – a site map showing every page and a wireframe for each page. I decided to create all deliverables using Microsoft Visio, knowing that I would be able to use its ability to layer backgrounds to reduce duplication of elements.

I knew from the start that I risked inconsistency in the large deliverable set – for example, it would be easy to have slightly different page titles in the site map and relevant wireframe. I initially thought I just needed to be careful, but after re-working the site map a few of times (manually renaming and renumbering shapes each time) I decided to look for a better way to manage data in the site map and wireframes.

Visio and databases

Visio allows you to connect shapes to data in a database and display database fields automatically in the shape.

You can connect individual shapes, or masters on a stencil – the process is the same for each. You can connect to a range of databases – I use Microsoft Access as I’m already familiar with it and I can easily send the database file to my client.

Create and populate the database

You need to first create a database and set a primary key – you cannot display data from the primary key in Visio, but will use it to select data, so make sure it is something recognisable. For this example, I used the same unique identifier for the page and the primary key. My database also has fields for page title and template/layout (I use different colour schemes and navigation for different parts of the site).

Screenshot of database table, showing ID, page number, page title columns

Populate the database with the data you will need for the site. This becomes the main source of data for the deliverables, and could be used for other parts of the project.

Connect a shape to the database

You connect a Visio shape and the database using the ‘Database Wizard’ (Tools>Add-ons>Visio Extras>Database Wizard). The wizard leads you through fairly well – below are some tips and instructions for the tricky spots only:

  • If you are trying to connect to a master on a stencil, make sure the stencil is editable first
  • If you are trying to connect to a shape and the list of shapes is very long, cancel out of the wizard, select your shape and start again. Your shape will be selected already.
  • The dialog box below sets up the connection between the shape and the database field. If you would like the shape to show the text from the database, select Shape.Text and the relevant database field and click add.

A screen shot of the dialog box used to select the shape element and database field

How I use this

For this project, my site map shapes contained a title, id number and layout/template. I connected each part of the shape to the relevant database record. When I duplicated the shape (copy>paste), instead of retyping the text, I connected it to the correct database record by right-clicking and selecting ‘select database record’ from the contextual menu.
image of some of the shapes on my site map, showing title, template and identifier
My wireframes use database connected shapes in a number of places:

  • background pages contain shapes for navigation items
  • the title bar contains the page number and title
  • the content area has a page title in the content
  • the notes area has the template or layout name
  • the notes area may also have a list of in-line links in the content

example of a wireframe showing where database fields are included, linked to a larger version

Other comments

This won’t be appropriate for all IA projects, but may be helpful for any where you are trying to manage large numbers of pages and repeating information in a number of places.

Visio is far from perfect, and one of the most annoying things is that you can’t ask it to automatically update shapes from the database. If you have changed records in the database, you have to right-click each shape and select ‘refresh shape properties’. So consider carefully before you do connect to a database, because this is almost as tedious as retyping everything (but not quite).

I’m sure I have left out plenty, so please leave a comment if you have questions.

Visio and IA tip – paste into same position

Sunday, July 3rd, 2005

Something that drives me crazy about visio is that it always pastes into the centre of the screen. I understand the rationale behind this (i.e. page sizes may vary), but what I almost always want to do is paste into the same position as I copied from – usually because I am duplicating from one page to another and want the positioning to be the same. This usually means I have to paste and then tediously align the pasted shapes.

So given there is no way to duplicate a page (grrrrr…) I have figured a way to get perfectly positioned pasting. For this, the source and destination pages must be the same page size (e.g. all same size paper):

  • On the source page, create a rectangle that is exactly the same size as the page (you may have to zoom in to get it exact), with no fill and a thin line. If you are very orderly, save this on your stencil and you will be able to identify it by name later.
  • Select all items you want to copy, plus this rectangle (select the rectangle by clicking right near the edge of the page).
  • Copy
  • Switch to the page where you want to paste.
  • Ctrl+w to zoom to whole page view (this is important!)
  • Paste

This will still paste to the centre of the screen, but given that whole page view centres the page, and the shape being copied is the size of the page, it will paste perfectly. Beautiful.

Later I delete the big rectangles, just to keep things tidy.

PS. Today I have been playing with ways of showing interactions using layers and events. I’ll practice a little more and post soon.

Visio and IA tips – set up before drawing

Tuesday, June 28th, 2005

At the moment, I’m working on large Visio files – a big site map, a set of page description diagrams and a wireframe for each page. When working with large files that use many repeated elements, it is worth spending time preparing your files and workspace. Believe me, it will save a lot of time later.

Visio has plenty of limitations when it comes to managing big documentation sets, but these tips will help to smooth the project at least a little.


For these types of projects, backgrounds are your friend. Visio allows you to set up a number of pages as ‘background’ pages. These can be applied to any foreground page, with all elements on the background page automatically appearing on the foreground.

Backgound pages can be nested, so with a bit of thought, you can save a lot of work with a series of backgrounds. As long as you have designed before drawing, you should be able to spot places where a background would be useful.

I set up one with a header and footer containing page title block, company details and version number. This is used by all pages in the set, with additional backgrounds for different, repeated layouts.

For an example of background use for wireframes, see Victor Lombardi’s wireframe templates, available from the IA institute.


There are a number of tools I use frequently but aren’t included in one of the standard toolbars. These include the align & distribute tools, and the layers tool (the one that lets you easily assign shapes to a particular layer). It is very worthwhile having these at my fingertips rather than behind menus, so I add them to existing toolbars or a custom toolbar.

I’m getting a lot of practice customising my toolbars, as I can’t seem to retain my toolbar settings between Visio sessions. I have resorted to ‘attaching’ them to a visio file that I open first, dragging them to my toolbar and then opening my files. Clumsy but better than re-setting everything every time I open a file.

Text styles

If your drawing contains a lot of text that needs similar appearances, set up text styles for them. As in other programs, this saves you from having to remember what font and paragraph settings apply to your text. This is pretty straightforward.

Keyboard shortcuts

Get to know your keyboard shortcuts. Dan Brown’s visio mousemat looks fabulous, and I will buy it shortly, but in the meantime, here are my most commonly used shortcuts:

  • ctrl+g: group
  • ctrl+shift+u: ungroup
  • ctrl+w: show whole page
  • F2: edit text (very handy for editing inside a grouped object)
  • F8: align
  • F4: duplicate/repeat last action (easier than ctrl+y)
  • ctrl+shift+select area: zoom into selection

I’m sure there are plenty that I’m not using. I’ll update this as I find other indispensible shortcuts.

Visio and IA tip – design before documentation

Wednesday, June 22nd, 2005

This tip is probably more of a note to self than a useful tip, but I have to keep reminding myself, so may be of value:

Visio is a documentation tool, not a design tool. The design happens elsewhere – in your head, on paper, on a whiteboard, in a team meeting. Only when you have figured out what your design looks like should you sit in front of the computer and try to document it.

When I find myself staring at the screen wondering what is meant to happen next, it is usually because I haven’t thought about what I am trying to draw. I get up, go to the whiteboard or paper, draw it (or at least list the components or workflows I need), then come back to the computer, set up shapes etc and draw.

Or I go for a walk…

What would you like to know about Visio and IA

Friday, June 17th, 2005

I’m likely to be spending most of the next month buried up to the eyeballs in Visio, and thought I might write up some short articles/posts about IA deliverables and Visio as I work.

If there is something that has frustrated you, that you have done inefficiently or that you would like to know more about, please let me know (via a comment or email) and I’ll attempt to come up with a good answer and some tips as I work through this project.

(and if you’re reading this because you’d like to know more about Visio, Dan Brown has some great posts over on