M
Michael Anderson
Hi Everyone,
This code is meant to read every record in the contacts folder. Instead I
get the current record printed out infinitely. I have been advised to
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'")
For Each objItem in myItems
Set objInspector = Item.GetInspector
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
This code is meant to read every record in the contacts folder. Instead I
get the current record printed out infinitely. I have been advised to
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'")
For Each objItem in myItems
Set objInspector = Item.GetInspector
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