L
Lennard N.
Hi folks,
I have created a Ribbon-Add-In for Microsoft Visio with Visual Studio 2010 and I really like doing this so far, but I have one major problem that I can't get over.
I try to dynamically change the stencil by reacting to events like ShapeAdded. I managed to delete a master from the stencil by doing something like this:
vsoMaster.Delete()
However, if I want to add a new master to an empty stencil (after all masters have been deleted) I do this:
Dim vMaster = vsApplication.Documents.Item("test.vss").Masters.Add()
This produces an empty master in the stencil.
Now, if I want this master to have a shape, I always get COMExceptions, e.g. when I try to do stuff like this:
vMaster.Shapes.Item(1).CellsSRC(Visio.VisSectionIndices.visSectionObject, Visio.VisRowIndices.visRowLine, Visio.VisCellIndices.visLineColor).FormulaU = "THEMEGUARD(RGB(0,0,0))"
It seems plausible for the program to react like that because there is no shape yet, but I can't find a way to assign a shape to the master.
Does anyone know a way to do that?
Thanks in advance for your help and best regards from Osnabrueck, Germany.
Lennard
I have created a Ribbon-Add-In for Microsoft Visio with Visual Studio 2010 and I really like doing this so far, but I have one major problem that I can't get over.
I try to dynamically change the stencil by reacting to events like ShapeAdded. I managed to delete a master from the stencil by doing something like this:
vsoMaster.Delete()
However, if I want to add a new master to an empty stencil (after all masters have been deleted) I do this:
Dim vMaster = vsApplication.Documents.Item("test.vss").Masters.Add()
This produces an empty master in the stencil.
Now, if I want this master to have a shape, I always get COMExceptions, e.g. when I try to do stuff like this:
vMaster.Shapes.Item(1).CellsSRC(Visio.VisSectionIndices.visSectionObject, Visio.VisRowIndices.visRowLine, Visio.VisCellIndices.visLineColor).FormulaU = "THEMEGUARD(RGB(0,0,0))"
It seems plausible for the program to react like that because there is no shape yet, but I can't find a way to assign a shape to the master.
Does anyone know a way to do that?
Thanks in advance for your help and best regards from Osnabrueck, Germany.
Lennard