Search code examples
vbams-officevisioshapesheet

Visio VBA - Adding Shape Data Properties


i'm creating and testing a UserForm where user can add the shapes and add the predefined Shape Data Value to the Shape Data. The Shape Data name is "Element" as you can see the image below.

enter image description here

Dim vsoRound As Visio.Shape
Dim cell As Visio.cell

If (CheckBox1.Value) Then

Application.ActiveWindow.Page.Drop Application.Documents.Item("MS Icons.VSSX").Masters.ItemU("Round"), 5, 5

Set vsoRound = Application.ActiveWindow.Page.Shapes.ItemU("Round")

vsoRound.CellsU("ELement").FormulaU = """Fan"""

The value for this Shape Data is Fan. However it break at the last line of the code.

**Update: I added the error message.

enter image description here

enter image description here


Solution

  • Document stencil window

    As workaround you can delete unused master Square in Visio Shape Test.vssm before drop master with same name from stencil MS Icons.vssx via your code!