Chapter 14 : Using Code to Enhance Functionality

Image of Chapter 14

In this chapter

  • Visual Basic for Applications (VBA)
  • Add-Ins
  • COM Add-Ins
  • Add-Ons
  • Wrapper Applications

Microsoft Visio is extensible. Everything in a Visio drawing is a SmartShape, whether it is just a single line or one character of text. A ShapeSheet is behind every Shape, and a ShapeSheet contains cells with formulae.

So, my first rule is:

Only resort to any coding if you cannot achieve what you want in the ShapeSheet.

My second rule is:

Encapsulate as much as possible in the ShapeSheet, and send as little chatter as you can between Shapes and Code to make it work.

I say this upfront because experience has shown me that too many good programmers ignore the power of the ShapeSheet and try to control everything in code. Then, they wonder why it starts to get complicated . . . and slow.

If you need code, then Microsoft Visio is delivered with Visual Basic for Applications (VBA) built-in. And, you can create add-ons, Component Object Model (COM) Add-ins, Visual Studio Tools for Office (VSTO) Add-ins, Add-ons, and wrapper applications. So, how do you make your choice?