By Adam Nagy
This requires a technique similar to that shown here: http://adndevblog.typepad.com/manufacturing/2014/04/run-command-on-browser-item.html
In this case will have to work on another Browser Pane, the one created by the FEA addin: "Stress Analysis"
We just have to find the component we want to toggle the Suppress state of, then execute the "FeaSuppressCmD" command on it:
Function FindNode( _ node As BrowserNode, label As String) As BrowserNode Dim subNode As BrowserNode For Each subNode In node.BrowserNodes If subNode.BrowserNodeDefinition.label = label Then Set FindNode = subNode Exit Function End If Dim foundNode As BrowserNode Set foundNode = FindNode(subNode, label) If Not foundNode Is Nothing Then Set FindNode = foundNode Exit Function End If Next End Function Sub SuppressFeaElement() Dim doc As Document Set doc = ThisApplication.ActiveDocument ' Get the control definition we need Dim cm As CommandManager Set cm = ThisApplication.CommandManager Dim cds As ControlDefinitions Set cds = cm.ControlDefinitions Dim cd As ControlDefinition Set cd = cds("FeaSuppressCmD") ' Find the item in the browser tree Dim elemName As String elemName = "Force:1" ' Stress Analysis browser pane Dim bp As BrowserPane Set bp = doc.BrowserPanes( _ "{B3D04494-EDD2-4FDC-9EC2-30BAF8D6B77B}") Dim node As BrowserNode Set node = FindNode(bp.topNode, elemName) ' Select it node.EnsureVisible ' might be needed node.DoSelect ' Run the command on it cd.Execute End Sub
The code in action: