I have only been developing Visio solutions for 25 years, but I got a surprise this week when I was trying to understand why I couldn’t update the value of a Shape Data row of multiple selected shapes. It is something that I often do, so it took me a while to understand why I was failing to change the values, even though it appeared to initially change in the Shape Data window. There was no problem selecting the shapes individually, but every time I selected multiple shapes and edited these particular rows, I could see the new value in the Shape Data window, but as soon as I looked at the individual shapes, I could see that the values never got changed. I checked my code in vain, and ran the Events Monitor from the Visio SDK. Visio seemed to enter the Shape Data scope, but then immediately exited it without attempting to apply the new value to the shapes. Very strange!
[Read more…] about Using a formula for Shape Data labels prevents multiple updatesShapeSheet
Automatic Line and Segment Lengths in Visio
Many years ago, I wrote some VBA code to calculate the length of a multi-segment line in Visio, see Automating Area and Perimeter Length Shape Data , but Microsoft have since provided a handy ShapeSheet function, PATHLENGTH(…), to do the same without any VBA. The function is described on one of the pages in Visio ShapeSheet Functions O-R , but here is one way that it can be incorporated into a useful shape for, say, cabling or piping, and thus be available in Shape Reports. Moreover, the Shape Data can display the length of each of the segments in the line, in addition to the total length.
[Read more…] about Automatic Line and Segment Lengths in VisioViewing Visio Document Changes in Git
Developing a Visio solution usually involves both .Net code and Visio ShapeSheet formulas. Good practice dictates that the source code is saved into a code repository, such as Git, where changes can be committed and commented. Visual Studio 2019 now includes native Git support, and can be linked to Azure DevOps easily. The code can be viewed by others and the changes made by commits can be reviewed. This is tried and tested for the .Net code, but any changes made to a Visio template, stencil or drawing document is a black box. If the Visio document is included in the Git project, then all that is visible is the fact that the file has been changed, but the detail of the actual changes are unknown. There may be some comments with the commit, but that is not a precise definition. So, what if there was a way to easily spot the changes?
[Read more…] about Viewing Visio Document Changes in GitUsing the CALLTHIS function in Visio
Visio was the first non-Microsoft application to include VBA within it back in the mid-nineties. All of the desktop Microsoft Office applications currently include VBA, although Microsoft have been rumoured to want to replace it for many years, and now there is an alternative scripting option becoming available that is suitable for the web too.
Visio was acquired by Microsoft in 2000, and there are still many scenarios when it is useful to have VBA procedures available in Visio for the Desktop. These procedures can be created using the recorder, and then edited, or just created manually. Every Visio document can contain a VBA project, but it must be saved with the .vsdm extension for documents, .vssm extension for stencils, or .vstm extension for templates. The last letter, m, informs Windows that this file could contain macros, as opposed to the normal last letter x, which cannot. Even with this extension, users, or their IT department, may not enable the macros in Visio documents.
The CALLTHIS function in Visio can be used to run a procedure (sub-function) in a Visio Visual Basic document and pass through a reference to the shape that the function is called from. The Microsoft Docs provide an explanation of this useful technique, and it does describe some examples, but it does not show the VBA code that these examples need, nor does it show them working. It also does not make it clear that these procedures do not need to be in the Visio diagram document, but can be in a stencil that is open in the active Visio session. This is important because it means that VBA code can be centralised and distributed for use use on many other documents.
[Read more…] about Using the CALLTHIS function in VisioReferencing Visio Shapes
Every Visio shape must have a unique name in the collection that it belongs to, and to ensure this, Visio automatically one using the master name or just “Sheet”, if not an instance of a master, followed by a period (“.”) and the ID. However, a user can rename a shape, and Visio will then also update the universal name (NameU) to be the same as the Name. If a user chooses to re-name a shape a second time, then thee universal name is not updated … it remains as the original name.
To demonstrate this I drew a rectangle, then named, and re-named it:
[Read more…] about Referencing Visio ShapesUsing Emojis in Visio
In the new normal of social distancing, we can easily miss the nuances of facial expressions with the the various electronic communication platforms that we utilise. In our personal communications via mobile apps, we have all started to use Emojis to express sentiment and actions, although we can sometimes convey the wrong meanings unintentionally as some Emojis get re-purposed by certain sections of society. Microsoft Windows 10 added native support for Emojis a year ago, and they can be inserted into many Microsoft applications using the onscreen keyboard 👀:
[Read more…] about Using Emojis in Visio