Retrieve ListBox multi-selection on a ProcessBook display

Discussion created by CDS on Dec 7, 2010
Latest reply on Dec 8, 2010 by CDS

Hi Forum !


I'm having trouble retrieving a multi-selection from a Listbox on a ProcessBook display. I couldn't find a solution in the existing threads on forum so I'm creating a new one.


I search in ProcessBook / VBA Help and found the following code to determine if the indexed item of the listbox is selected :


        If ListBox1.Selected(i) = True Then
            ' ... my actions
        End If

 This code is working well when I copy/paste in Excel VBA but the same code is throwing an error in ProcessBook VBA. The error says : "Wrong number of arguments or invalid property assignment" on the ".Selected".


Does someone have any idea ?


For information my ListBox is configured like that :

  • ListStyle = 1 - fmListStyleOption
  • MultiSelect = 1 - fmMultiSelectMulti

My excat code is :


Private Sub GenerateBtn_Click()
    Dim i As Long
    Dim myMessage As String

        For i = 0 To ListBoxGC.ListCount - 1
            If ListBoxGC.Selected(i) = True Then
                myMessage = myMessage & ListBoxGC.List(i) & ";" & vbCrLf
            End If
        Next i
        MsgBox myMessage

End Sub


Am I doing something wrong or is that a ProcessBook restriction / known bug ? Is anyone aware of a work-around ?


Thanks in advance for your help.