multiselect Listbox value

G

Guest

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
 
S

Sue Mosher [MVP-Outlook]

Michael, I'm still waiting for a response from you at http://www.outlookcode.com/threads.aspx?forumid=3&messageid=16336. If there was something you didn't understand about my suggestion, please ask directly in the original thread.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

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

Michael Anderson


Sue Mosher said:
Michael, I'm still waiting for a response from you at http://www.outlookcode.com/threads.aspx?forumid=3&messageid=16336. If there was something you didn't understand about my suggestion, please ask directly in the original thread.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Michael Anderson said:
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
 

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