There are literally thousands of master shapes in the stencils supplied with Microsoft Visio, so I guess that mistakes can creep in. One error that I have noticed is the inability of the default text control handle of many of the network shapes to actually move the text block horizontally.

It moves the vertical position without a problem, as can be seen in this short video:
The fix is straight forward enough. The TxtPinX cell is missing the formula =SETATREF(Controls.visSSTXT) , so this following VBA macro can fix that for an active document. It will need to be run after the problem master shapes have been first used in the document, but then they are fixed for ever….
Public Sub FixTheTextControlHandle()
On Error GoTo errHandler
Dim mst As Visio.Master
Dim mstCopy As Visio.Master
Dim shp As Visio.Shape
Dim curFormula As String
'This is the referenced cell
Const cll As String = "Controls.visSSTXT"
'This is the missing formula
Const frml As String = "SETATREF(Controls.visSSTXT)"
For Each mst In ActiveDocument.Masters
If mst.Shapes(1).CellExistsU(cll, Visio.VisExistsFlags.visExistsAnywhere) <> 0 Then
curFormula = UCase(mst.Shapes(1).CellsU(cll).FormulaU)
If Not UcurFormula = UCase(frml) And _
Not InStr(curFormula, "GUARD") > 0 Then
Set mstCopy = mst.Open
Set shp = mstCopy.Shapes(1)
shp.CellsU("TxtPinX").FormulaForceU = "=" & frml
mstCopy.Close
mst.MatchByName = True
End If
End If
Next
exitHere:
Exit Sub
errHandler:
MsgBox Err.description, vbExclamation, "FixTheTextControlHandle"
Resume exitHere
Resume
End Sub
Then the control handle can move the text block horizontally too:
I have informed Microsoft of the bug, and hope they will fix it soon.
Using Notepad++ to Edit Visio ShapeSheet formulas
Visio shapes get their smartness from the formulas that are entered into the ShapeSheet, but editing these formulas can be extremely tricky and prone to error because of the lack of a modern programmer’s interface. Formulas can be quite long (up to 64k characters) but even medium size ones like the one in User.GetWorkdays cell…
Adding a second Function header bar to Visio swimlanes
I was recently asked if a second function header bar can be added to the swimlanes in the cross-functional flowchart templates in Visio. Some swimlanes can get quite wide, so it can be useful to have a duplicate function header shape on the far-side too. It is quite simple to duplicate the existing function header…
More Parsing XML Data in Visio Shapes
My last article looked at parsing an XML string with a known structure and order of elements and attributes. This can be acceptable in some scenarios, but what if the elements or attributes are in a different order? Then it is necessary to use the element and attribute names rather than their index position. This…
Parsing XML data in Visio Shapes
One of my current projects uses XML data, and some of the values in the XML data control the display and content of Visio shapes. Therefore, I looked deeper into how the XML data can be used directly to control parts of the graphics. Although the external data linking feature in Visio Professional and Visio…
Highlighting dirty text in Visio shapes
I suppose I should explain what I mean by dirty text first 🙂 I often display the value of a Shape Data row in Visio text, but sometimes the solution requires that the value is also editable. This is ok if the client accepts that all editing is done with the Shape Data window or…
My new book on Visualizing Processes with Microsoft Visio has launched
Back in the early 1990s, there was an application called ABC Flowcharter that was the market leader for diagramming business flowcharts, but some of the brains behind Aldus PageMaker saw an opportunity to create something smarter, and left to write the Visio product, with the stated aim to overtake ABC Flowcharter within 2 years. They…
Leave a Reply