• 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
    • 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
    • Visualizing Construction Project Schedules
    • Visio Online Business Process Mapping
    • Nexans Visio Template
    • VRA makes the case for Prudential
    • 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
      • 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➡
      • 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
    • Visio blog on Orbus website
    • 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

Leave a Reply Cancel reply

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

Primary Sidebar

  • LinkedIn
  • Twitter

Recent Posts

  • Visio in Organizations
  • Viewing Visio Document Changes in Git
  • Visio ShapeSheet Functions D-F
  • Visio ShapeSheet Functions A-C
  • Using the CALLTHIS function in Visio

Categories

Tags

Accessibility Add-Ins Connectors Data Export Data Graphics Data Import Data Visualizer Educational Excel GraphDatabase Hyperlinks Icon Sets JavaScript Layers Legend Link Data to Shapes MSIgnite Office365 Org Chart PowerApps PowerBI PowerQuery Processes Shape Data Shape Design ShapeSheet ShapeSheet Functions SharePoint SharePoint 2013 SQL Teams Themes Validation VBA Video Visio Visio 2007 Visio 2013 Visio for the Web Visio Online Visio Pro for Office365 Visio Services Visio Viewer Web 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

  • LinkedIn
  • Twitter

Search this website

Recent posts

  • Visio in Organizations
  • Viewing Visio Document Changes in Git
  • Visio ShapeSheet Functions D-F
  • Visio ShapeSheet Functions A-C
  • Using the CALLTHIS function in Visio

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