AnsweredAssumed Answered

Regroup and Ungroup in Process Book Display in VBA

Question asked by RonaldMain on Nov 13, 2016
Latest reply on Nov 17, 2016 by Kenji Hashimoto

Hi I've been working on process Book Display to do the following

The Display contains some symbols previously defined

for example : pbSymbolText(Tag Value, Tag Name)

They are grouped (symbol type = 0)

Like this there are 10 groups



I want to take each group and extract the tag name in a string array.

Then I will do my stuff ...


My issue is that I am unable to get the Contents(Text) when the symbols are grouped.

However, when I ungroup, I am able to get the content(Tag Name).

But when I iterate to next group it gives an error at

ThisDisplay.SelectedSymbols.Ungroup             - The property or method is unsupported.


In the end I want the tags Name and Tag value to be grouped as before.

Also, can you give links of how to dynamically set size of string array, is there a way to use List/Vectors in VBA?

and optimised code for  If Not() statement I've used---- > I feel this is bit unreadable




Dim ExistObjects(100) As String
Dim i As Integer
i = 1
Dim t As Text
Dim s As Symbol

For Each r In ThisDisplay.Symbols
r.Selected = False
Next r

For Each s In ThisDisplay.Symbols
    If s.Type = 0 Then
      s.Selected = True
         For Each Sym In ThisDisplay.Symbols
                 If Sym.Type = pbSymbolText Then
                     Set t = Sym
                     If Not ((t.Contents = "Device Alert") Or (t.Contents = "In Service") Or (t.Contents = "Not In Service") Or (t.Contents = "Malfunction")) Then
                     ExistObjects(i) = t.Contents
                     i = i + 1
                     End If
                 End If
         Next Sym
           End If
Next s