Site icon bVisual

Correcting the Text Control Handle on Visio Network Shapes

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:

https://bvisual.net/wp-content/uploads/2021/11/NetworkShapesTextControlHandleBug.mp4

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:

https://bvisual.net/wp-content/uploads/2021/11/NetworkShapesTextControlHandleFixed.mp4

I have informed Microsoft of the bug, and hope they will fix it soon.

A visual exploration of Penrose Tiling in Visio

Maybe it is because I used to be a building architect, but I have always been fascinated by the relationship between numbers and visualisations. Perhaps the most famous one is the Golden Ratio which has been used as the basis of many building designs and art pieces. It is often recognised to create a harmony…

How SVG in Visio can cause a Shape.BoundingBox(…) error

I have used Visio’s Shape.BoundingBox(…) for many, many years and I cannot ever recall it failing, but I have now managed to create some shapes that cause it to error. This caused many hours of confusion, so I nearly abandoned using the method, until I discussed it with my fellow Visio MVP, John Goldsmith (see…

Jumping between Shapes in Visio

Many Visio diagrams get quite large, and sometimes it is useful to provide the ability to jump to another shape quickly in the same document, either on a different page or on the same one. Although there is an add-on provided in desktop Visio that is used by the Off-Page Reference shape provided in the…

Fixing dimensions of 2D shapes

I am often asked what makes Visio unique and makes it stand out from the crowd, especially in today’s online world. Well, I think there are many reasons, but one of them is the ability to create scaled drawings with parametric components of specific dimensions. This was crucial for my adoption of Visio back in…

Smart Radio Buttons and Check Boxes in Visio

A recent project requires an interactive tutorial within Microsoft Visio desktop where a lot of the questions need a single answer using radio buttons, or multiple-choice answers using check boxes. I thought that this would be a great use of the list containers capability because the questions and answers could be part of the container…

Using Button Face Ids in Visio

Microsoft Visio desktop has the ability to display icons from a built-in list of Office icons on Actions and Action Tags (nee Smart Tags). These can be set in the ShapeSheet by using the desired number from several thousand in the ButtonFace cell. Although there is the ability to add better icons using code, the…

Exit mobile version