Creating an IsMetric function in Visio

John Goldsmith

In Visio, a page's drawing units are defined by the value found in the DrawingScale cell. Like all cells you can interrogate this in code via the Cell.Units
property, but in the ShapeSheet, there's no direct method to find out the same information. So I thought I'd write down one way you could approach this.
The FORMAT function

I think the ideal would be some kind of dot syntax where you could write something like ThePage!DrawingScale.Units
, but unfortunately that's not valid in the ShapeSheet.
The FORMAT
function, however, can be used to extract the units component and you can then use this to check if it's a string of a particular type. So, for example, if you want to know if the page is metric then you just need to test against mm, cm, m and km:

That's just one approach of course. If you want to extend this you could separate the units element out into another cell which you could then use in further evaluation or to combine back into a formula to be pushed into another target. Here's a (slightly contrived) example of the latter:

One last thing to bear in mind is case-sensitivity. In the first example above, the LOOKUP
function case-insensitive, in the UnitsStr example you might well be using string comparison with STRSAME
, in which case you might want to use its third optional parameter which allows for case-insensitive matching.
Visio Blogs
- Bill Morein (via Wayback Machine)
- Chris Castillo (via Wayback Machine)
- Chris Hopkins (via Wayback Machine)
- David Parker
- Eric Rockey
- Jesse Phillips-Mead
- John Marshall
- Michel LAPLANE (FR)
- Nikolay Belyh
- Saveen Reddy (via Wayback Machine)
- Visio Guy
- Visio [Product] Blog
- Visio Insights (via Wayback Machine)