VBScript Get value from multiselect Listbox

M

mike

Hi Everyone,

Sue Mosher MVP has been most patient with the following attempt to
customise a contact form. Her answers don't seem to be working just
this once! This code is meant to read every record in the contacts
folder. Instead I get the current record printed out infinitely. Ms
Mosher says that I should obstantiate the "ListBox3" control from
"objItem" rather than "Item". Can someone please provide me with the
precise syntax for doing that, please?

Sub cboNCRL_Click()

Dim olNS
Dim MyFolder
Dim myItems
Dim objItem
Dim objInspector
Dim objPage2
' custom variable
Dim mxztxtNCRL2
Dim intI

Set olNS = Item.Application.GetNameSpace("MAPI")
Set MyFolder = olns.GetDefaultFolder(10).Items
Set myItems = MyFolder.Restrict("[MessageClass] =
'IPM.Contact.Contact'")

Set objInspector = Item.GetInspector

For Each objItem in myItems
Set objPage2 =
Item.GetInspector.ModifiedFormPages("Assessor").ListBox3
Set mxztxtNCRL2 = objPage2.Controls("ListBox3")
For intI = 0 to mxztxtNCRL2.ListCount - 1
If mxztxtNCRL2.Selected(intI) = True Then
MsgBox mxztxtNCRL2.List(intI)
End If

Next
Next

Set mxztxtNCRL2 = Nothing
Set intI = Nothing
Set objInspector = Nothing
Set objPage2 = Nothing
Set olNS = Nothing
Set myItems = Nothing
Set MyFolder = Nothing
Set objItem = Nothing

End Sub
 
M

mike

If anyone else reads this, I have sorted out the problem so please
don't post any more suggestions to this thread.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top