For checking whether a cell exists, Visio has a very elegant solution with the Exists methods for cells.
Unfortunately for checking whether a master exists in a stencil, I cannot find an elegant solution. (I found an extensive topic on how to check if a master exists on this forum but no elegant solution).
In a VB.NET add-in I can of course use Masters.ItemU("Universal name of master") by putting it in a Try...Catch block to check if the master exists, by either raising an exception or not, but this is ugly programming.
If no elegant solution exists, I would hope Microsoft adds a MasterExists method to Visio 2023, but maybe I am overlooking an elegant solution that exists today.
If you don't like the exception (I have no problem with them) then just wrap it in a procedure.
Thank you for that idea Paul that will make the code flow nice & clean again!