• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

bVisual

  • Home
  • Services
    • How Visio smartness can help your business
    • Visio visual in Power BI
    • Visio Consulting Services
    • Visio Bureau Services
    • Visio Training and Support Services
  • Products
    • Visio Shape Report Converter
    • SS Plus
    • LayerManager
    • visViewer
    • Metro Icons
    • Rules Tools for Visio
    • The Visio 2010 Sessions App
    • Multi-Language Text for Visio
    • Document Imager for Visio
    • multiSelect for Visio
    • pdSelect for Visio
  • Case Studies
    • Case studies overview
    • Using Visio in Education for GIS
    • Visualizing Construction Project Schedules
    • Visio Online Business Process Mapping
    • Nexans Visio Template
    • CNEE Projects, WorldCom
    • Chase Manhattan Bank
  • News
    • Recent news
    • News archive
  • Resources
    • Articles➡
      • ShapeSheet Functions A-Z
      • Comparing Visio for the Web and Desktop
      • Customising Visio Shapes for the Web App
      • Key differences between the Visio desktop and web apps
      • Using the Visio Data Visualizer in Excel
      • Using Visio in Teams
      • Creating Visio Tabs and Apps for Teams with SharePoint Framework (SPFx)
      • Designing Power Automate Flows with Microsoft Visio
      • Innovative uses of Visio Lists
    • Webcasts ➡
      • Visio in Organizations
      • My session and other Visio sessions at MSIgnite 2019
      • Power up your Visio diagrams
      • Vision up your Visio diagrams
      • The Visio 2010 MVP Sessions
    • Visio Web Learning Resources
    • Books➡
      • Visualize Complex Processes with Microsoft Visio
      • Mastering Data Visualization with Microsoft Visio
      • Microsoft Visio Business Process Diagramming and Validation
      • Visualizing Information with Microsoft Visio
  • Blog
    • Browse blog articles
    • Visio Power BI articles
    • Visio for Web articles
    • A history of messaging and encryption
  • About us
    • About bVisual
    • Testimonials
    • Bio of David Parker
    • Contact Us
    • Website Privacy Policy
    • Website terms and conditions
    • Ariba Network
You are here: Home / Visio / Fixing the Layers problem with Callouts in Visio

Published on October 24, 2018 by David Parker

Fixing the Layers problem with Callouts in Visio

I recently re-discovered an issue with callouts in Visio for a couple of projects that I am working on, and so I had to find a fix. The problem is that the callouts become dis-associated from their target shapes if either the layer visibility of the callout or the target shape is toggled off, and then back on again. This will result in a diagram with shapes without any connected callouts, so moving any of the target shapes will not move their associated callouts with them! I initially came up with a workaround that involved some jiggery-pokery with sub-shapes and layers, but it seems that the problem could have easily been averted if Microsoft had incorporated one specific User-defined Cell from the very start…


First, I should be clear which callouts I am talking about because the word has been used and abused over the years … This article refers to the callouts that are inserted from the Insert / Diagram Parts ribbon group. These are part of the Structured Diagrams concept that was introduced with Visio 2010.

I told the Visio development team about my findings and they trawled through the documentation that was originally created before the code base was passed from USA to India, and found this blog post. In short, there is an optional User.msvSDMembersOnHiddenLayer row, and, if it has a value, and if the value has a value of True then this disassociation would not happen at all.
Therefore I wrote a macro, FixCallouts(), to add this missing setting to any callout shapes in a document. This needs to re-run if any different types of callouts are added. I also discovered that there are two other requirements because of recent changes to Visio to add accessibility:

  1. Save the Visio document and re-open it to ensure that Visio heals inheritance of the User-defined Cells section because the Visio interface adds a row called visNavOrder to the shape instances
  2. Add the visNavOrder row to the master shape BEFORE adding msvSDMembersOnHiddenLayer


Note that the User-defined Cells section rows with black values are inherited from the master shape.
This is the code for the macro, with error trapping removed for brevity:

Public Sub FixCallouts()
Dim mst As Visio.Master
Dim shpMst As Visio.Shape
Dim shp As Visio.Shape
Dim mstCopy As Visio.Master
Dim sect As Integer
Dim row As Integer
	sect = Visio.VisSectionIndices.visSectionUser
	'Loop through the Masters
	For Each mst In ActiveDocument.Masters
	    Set shpMst = mst.Shapes(1)
	    'Check if structured (.IsCallout does not work in a master)
	    If shpMst.CellExistsU("User.msvStructureType", _
		Visio.VisExistsFlags.visExistsAnywhere) <> 0 Then
	        'Check if a Callout shape
	        If shpMst.CellsU("User.msvStructureType").ResultStr("") = _
		  "Callout" Then
		    If shpMst.CellExistsU("User.msvSDMembersOnHiddenLayer", _
			Visio.VisExistsFlags.visExistsAnywhere) = 0 Then
			'Open the master to edit it
			Set mstCopy = mst.Open
			Set shp = mstCopy.Shapes(1)
			'May need to add User.visNavOrder first!
			If shpMst.CellExistsU("User.visNavOrder", _
				Visio.VisExistsFlags.visExistsAnywhere) = 0 Then
				row = shp.AddNamedRow(sect, "visNavOrder", 0)
			End If
			'Then add User.msvSDMembersOnHiddenLayer
			row = shp.AddNamedRow(sect, _
				"msvSDMembersOnHiddenLayer", 0)
			shp.CellsU("User.msvSDMembersOnHiddenLayer").FormulaU = "=TRUE"
			'Closing saves the changes
			mstCopy.Close
			'Set the Match Master by Name on Drop to True to avoid duplicates
			mst.MatchByName = 1
		    End If
	       End If
            End If
        Next mst
End Sub

 
So, after running this macro an existing Visio document that contains callouts, the layers of either the callouts or the target shapes can be toggled without breaking the associations!


The macro can be downloaded from here. Simply save the macro-enabled stencil, FixCalloutsIssue.vssm, in your My Shapes folder, and open it within Visio when required. The macro can be run from View / Macros …
 
 

Related

Filed Under: Callouts, Layers, Visio Tagged With: Callouts, ShapeSheet

About David Parker

David Parker has 25 years' experience of providing data visualization solutions to companies around the globe. He is a Microsoft MVP and Visio expert.

Reader Interactions

Comments

  1. Tye E says

    October 14, 2021 at 9:15 pm

    Hello David, This was a huge help and I can’t believe Microsoft hasn’t just configured this by default yet or at least in my testing hasn’t. One question, I have a master Template .vstx (not macro enabled) that I store in SharePoint Online and then call to the master Template from the Document Library so that when a new drawing is created it will leverage the master Template file which contains my stencil. The only catch is the Callout has to be use from the stencil and not from the >Insert >Diagram Parts menu to leverage the structured diagram callouts. My question is your Macro is saved on my machine in My Shapes folder, but how can I do this from an enterprise standpoint to be able to leverage the Macro in my master stencil? I’m not real skilled at Macros, but to attempt to answer my own question. I assume I somehow need to get the macro on a new macro enabled .vstm template file instead, but then I would have to enable Macros every time when prompted from a user standpoint. I’ve attempted but have been unsuccessful. The benefit of course would be that I could use any Callout shape instead of one from my stencil that has the 2 User Defined rows applied, which works like a charm by the way (Thank you). Just curious if there is a better way to enable for all callouts via a template stored in SharePoint online where I can leverage all callouts via macro or should I just cut my losses and go with the stencil Callout shape which will maintain the layers functionality?

    Reply
    • David Parker says

      October 15, 2021 at 8:24 am

      Tye,
      If I understand correctly, you have a custom template that is used via SharePoint?
      So, edit the custom template on your local PC, and add each of the Callouts to a page, and then delete them (not using Undo). This will add them to the usually hidden Document Stencil. Then run my macro, and save the template back to SharePoint.
      The custom template will now contain the modified masters, and whenever a user drags a callout from a stencil or inserts from the ribbon, then the fixed master will be used because the Match master by name property is ticked.

      Reply
      • Tye E says

        October 15, 2021 at 10:10 pm

        David Thank you, this is way more simple this way and that worked great! I think I was overthinking it and forgot to consider that once the master was added to the page that it would cover the change that way. Really appreciate your help here and this isn’t the first time I’ve visited your site. Will you be doing any upcoming sessions at Ignite? Cheers!

        Reply
  2. Doug Moore says

    September 13, 2023 at 6:12 pm

    Hello David,
    It appears that several Callouts are available in Visio Plan 1 however it appears that they can’t be attached to a shape. I can select and drag them to my page but they are static (can’t attach automatically or manually) 🙁
    Is there a procedure to attach a callout to a shape for ‘Visio Plan 1’?
    Thank you.

    Reply
    • David Parker says

      November 29, 2023 at 2:08 am

      Well, I share your frustration with the “callout” shapes available in Visio Plan 1 (and other web editions of Visio). They appear to be a poor imitation of the structured diagramming Callot shapes in desktop Visio. I have reported this to Microsoft.

      Reply
      • Doug says

        November 29, 2023 at 3:48 am

        Hi David,
        Thank you so much. I’ve got my fingers crossed that Microsoft will fix this bug ASAP. This sounds like a flaw in their testing, Since they provided the callouts, I assume that they wanted them to work.

        Reply
      • David Parker says

        November 29, 2023 at 4:07 am

        I investigated further :
        Calling out for a better Visio callout in the web!
        https://bvisual.net/2023/11/29/when-is-a-visio-callout-not-a-callout/

        Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

  • LinkedIn
  • Twitter

Recent Posts

  • Fixing dimensions of 2D shapes
  • Merging Linked Data from Similar Tables
  • Smart Radio Buttons and Check Boxes in Visio
  • Using Button Face Ids in Visio
  • Grid Snapping Revisited

Categories

Tags

Accessibility Add-Ins Connectors Containers Data Export Data Graphics Data Import Data Visualizer Educational Excel GraphDatabase Hyperlinks Icon Sets JavaScript LayerManager Layers Legend Link Data to Shapes Lists MSIgnite MVP Office365 Org Chart PowerApps PowerBI PowerQuery Processes Setup and Deployment Shape Data Shape Design ShapeSheet ShapeSheet Functions SharePoint 2013 SQL Teams Validation VBA Video Visio Visio 2007 Visio for the Web Visio Online Visio Services Visio Viewer Webinar

Footer

bVisual Profile

The UK-based independent Visio consultancy with a worldwide reach. We have over 25 years experience of providing data visualization solutions to companies around the globe.

Learn more about bVisual

  • Amazon
  • E-mail
  • Facebook
  • LinkedIn
  • Twitter
  • YouTube

Search this website

Recent posts

  • Fixing dimensions of 2D shapes
  • Merging Linked Data from Similar Tables
  • Smart Radio Buttons and Check Boxes in Visio
  • Using Button Face Ids in Visio
  • Grid Snapping Revisited

Copyright © 2025 · Executive Pro on Genesis Framework · WordPress · Log in