BPMN Stencil - With Linecolor change as per the input of user

Started by shamvi, April 19, 2016, 08:45:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

shamvi

Hello!
I am creating a Stencil, based on BPMN but with more functionalities. This is for users to create flowchart for each department. So when user right clicks on the shape, by selecting the department the linecolor of the shape should change.  To achieve this I created a User defined property for the shape, then created actions in shape sheet.
Then I used the following formula in the LineColor:

=IF(User.D=1,THEMEGUARD(RGB(255,0,0)),IF(User.D=2,THEMEGUARD(RGB(0,0,255)),IF(User.D=3,THEMEGUARD(RGB(0,255,0)),0)))

But it did not work! It works on other simple basic shapes but not on BPMN shapes. Any help on this will be appreciated.

JuneTheSecond

The shape may be a complicated group shape.
You have to find the correct sub shape to change line color.
Easy way to find the sub shape is to record maro.
Change line color manually with a main menu of line color in Visio.
If you found it is sheet.2 then add user.E or other name you like on parent shape, and write formula there
=SETF(GetRef(Sheet.2!LineColor),IF(User.D=1,"THEMEGUARD(RGB(255,0,0))",IF(User.D=2,"THEMEGUARD(RGB(0,0,255))",IF(User.D=3,"THEMEGUARD(RGB(0,255,0))",0))))
Best Regards,

Junichi Yoda
http://june.minibird.jp/

shamvi

Thank you. You are correct about the group shape. I did record a macro, but still working to get the correct sub shape!

JuneTheSecond

Perhaps, it may be the last sub shape, youngest number.
For example, Sheet.43 in the next record.

Sub Macro1()

    'Enable diagram services
    Dim DiagramServices As Integer
    DiagramServices = ActiveDocument.DiagramServicesEnabled
    ActiveDocument.DiagramServicesEnabled = visServiceVersion140 + visServiceVersion150

    Dim UndoScopeID1 As Long
    UndoScopeID1 = Application.BeginUndoScope("Line color")
    Application.ActiveWindow.Page.Shapes.ItemFromID(42).CellsSRC(visSectionObject, visRowLine, visLineColor).FormulaU = "THEMEGUARD(RGB(0,176,80))"
    Application.ActiveWindow.Page.Shapes.ItemFromID(42).Shapes.ItemFromID(57).CellsSRC(visSectionObject, visRowLine, visLineColor).FormulaU = "THEMEGUARD(RGB(0,176,80))"
    Application.ActiveWindow.Page.Shapes.ItemFromID(42).Shapes.ItemFromID(44).CellsSRC(visSectionObject, visRowLine, visLineColor).FormulaU = "THEMEGUARD(RGB(0,176,80))"
    Application.ActiveWindow.Page.Shapes.ItemFromID(42).Shapes.ItemFromID(44).Shapes.ItemFromID(46).CellsSRC(visSectionObject, visRowLine, visLineColor).FormulaU = "THEMEGUARD(RGB(0,176,80))"
    Application.ActiveWindow.Page.Shapes.ItemFromID(42).Shapes.ItemFromID(44).Shapes.ItemFromID(45).CellsSRC(visSectionObject, visRowLine, visLineColor).FormulaU = "THEMEGUARD(RGB(0,176,80))"
    Application.ActiveWindow.Page.Shapes.ItemFromID(42).[u]Shapes.ItemFromID(43)[/u].CellsSRC(visSectionObject, visRowLine, visLineColor).FormulaU = "THEMEGUARD(RGB(0,176,80))"
    Application.EndUndoScope UndoScopeID1, True

    'Restore diagram services
    ActiveDocument.DiagramServicesEnabled = DiagramServices

End Sub

Best Regards,

Junichi Yoda
http://june.minibird.jp/

shamvi