Visio Guy

Visio Discussions => Programming & Code => Topic started by: MrSir on August 18, 2014, 11:24:17 AM

Title: Define shape type for custom shapes in stencil file - Visio 2013
Post by: MrSir on August 18, 2014, 11:24:17 AM
Hello

Im developing custom Visio stencils/shapes and i would like to define the type for these shapes. I have looked under Properties, and the Property Sheet, but no luck.
I have also tried to use the "Shape name" function under Developer, this does not work either.

How do i define the type/name for a custom shape?

I need to be able to reference the shapes by name when using Visio through the COM interface. Microsoft.Office.Interop.Visio, like this:

Microsoft.Office.Interop.Visio.Master visioRectMaster = visioStencil.Masters.get_ItemU("Rectangle"); // <-- This Works, Rectangle is a build in type from "Basic shapes.vss"
Microsoft.Office.Interop.Visio.Shape visioRectShape = visioPage.Drop(visioRectMaster, 4.25, 5.5);

Microsoft.Office.Interop.Visio.Master visioRectMaster = visioStencil.Masters.get_ItemU("MyCustomShapeType"); // <-- This does not work!
Microsoft.Office.Interop.Visio.Shape visioRectShape = visioPage.Drop(visioRectMaster, 4.25, 5.5);


Regards MrSir
Title: Re: Define shape type for custom shapes in stencil file - Visio 2013
Post by: Paul Herber on August 18, 2014, 11:45:10 AM
Have you opened the stencil containing the shape?
Title: Re: Define shape type for custom shapes in stencil file - Visio 2013
Post by: MrSir on August 18, 2014, 11:50:35 AM
Hello Paul

I don't understand the question, i have developed the shapes in Visio.

Ragards MrSir
Title: Re: Define shape type for custom shapes in stencil file - Visio 2013
Post by: daihashi on August 27, 2014, 01:49:42 AM
on your document stencil pane, right click on the master that you'd like to rename and choose "rename master". Alternatively you could do it programmatically by doing something like, assuming your master's current name is "Master", and you wanted to change it to "NEWname".

Sub changename()
     ActiveDocument.Masters("Master").Name = "NEWname"
End Sub