I have shamelessly borrowed this code (thank you Visio Guy) and wrapped it in a callable sub. When I first ran this it produced a system error #NAME although the code compiles without error. The second time I tried it (trying to pin point the error) it came back another error "Delivery name already exits, choose another" Examining the shape sheet reports a partially completed property but it does not meet .CellExistsU().
Here's the code:
Private Sub AddShapeProp(ByRef oShape As Visio.Shape, PropName As String, PropPrompt As String, PropValue As String)
'Adds the user property to existing shape
Dim intPropRow As Integer
intPropRow = oShape.AddRow(visSectionProp, visRowLast, visTagDefault)
With oShape
.Section(visSectionProp).Row(intPropRow).NameU = PropName
.CellsSRC(visSectionProp, intPropRow, visCustPropsLabel).FormulaU = QuoteIt(PropName)
.CellsSRC(visSectionProp, intPropRow, visCustPropsType).FormulaU = "0"
.CellsSRC(visSectionProp, intPropRow, visCustPropsFormat).FormulaU = ""
.CellsSRC(visSectionProp, intPropRow, visCustPropsLangID).FormulaU = "1043"
.CellsSRC(visSectionProp, intPropRow, visCustPropsCalendar).FormulaU = ""
.CellsSRC(visSectionProp, intPropRow, visCustPropsPrompt).FormulaU = PropPrompt
.CellsSRC(visSectionProp, intPropRow, visCustPropsValue).FormulaU = PropValue
.CellsSRC(visSectionProp, intPropRow, visCustPropsSortKey).FormulaU = ""
End With
End Sub
Don't seem to be able to paste a snip from the shape sheet But I can email it if needed, also the function Quoteit() just appends fore and aft quotes to the value