1 Reply Latest reply on Jul 9, 2012 5:47 PM by mhamel

    Ungroup a symbol in Processbook using VBA

    rnakhaee

      I'm having trouble ungrouping a selected symbol using VBA. This is the code I've used:

       

             Display1.SelectedSymbols.Ungroup (Display1.Symbols.Item(Item_number))

       

      The error message is: Wrong number of arguements or invalid property assignment.

       

       

       

      Any ideas?

       

      Thanks,

       

      Roozbeh Nakhaee

       

       

       

       

        • Re: Ungroup a symbol in Processbook using VBA
          mhamel

          @Roozbeh: A call to the Ungroup method like you did is not supported. In my example, I have three symbols on my display page. Two of them are grouped. It means, the Symbols collection will indicate a count of two. Make sure you grab a reference to the composite object and call SelectedSymbols.Ungroup method.

           

          I added an excerpt of code showing how to do this.

           
          Dim MySymbol As PBObjLib.Symbol
          Dim MySelectedSymbol As PBObjLib.Symbol
          
          'Unselect all symbols on the display page.
          For Each MySelectedSymbol In ThisDisplay.SelectedSymbols
               MySelectedSymbol.Selected = False
          Next
               
          'Browse through each symbol     
          For Each MySymbol In ThisDisplay.Symbols
               'Select the symbol.
               MySymbol.Selected = True
               
               'Validate if the current symbol is made of many (composite)
               If MySymbol.Type = pbSymbolComposite Then
                    'Force to ungroup.
                    Call ThisDisplay.SelectedSymbols.Ungroup
               End If
               
               'Unselect the symbol(s) to avoid addition of selection.
               ThisDisplay.SelectedSymbols.Item(1).Selected = False
          Next
          

           

           

          Let me know if that worked.