Skip to content
  • Home
  • Work
  • About
  • Blog
  • Contact

Creating an IsMetric function in Visio

John Goldsmith's profile image

John Goldsmith

24 January 2019
  • ShapeSheet

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.

Microsoft MVP Logo

John has been a Microsoft MVP, in the award categories of Visio and M365, since 2008.

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)

Visio Resources

  • Developing Microsoft Visio Solutions
  • Visio Stencils at ShapeSource
  • Microsoft Visio YouTube Playlist
  • Visio (Product site)
  • Office 2010 Engineering
  • Visio 2016 SDK (Download)
  • Visio JavaScript API reference
  • VisioMVPs.org
Contact

visualSignals ltd
31 Riverview Grove
London, W4 3QL
United Kingdom

+44 (0) 208 078 9120

Around the Web

Copyright © visualSignals ltd 2025

Mastodon