> It's not at all clear what you're trying to do other than fill a list box. Please fill us in on the bigger picture.
>
> You can also write code behind your form to store the data needed to fill the list box so you can load it from the information in the form during the Item_Open event.
> --
> Sue Mosher, Outlook MVP
> Author of Configuring Microsoft Outlook 2003
>
http://www.turtleflock.com/olconfig/index.htm> and Microsoft Outlook Programming - Jumpstart for
> Administrators, Power Users, and Developers
>
http://www.outlookcode.com/jumpstart.aspx>
> "John E." <je.lodestar[ at ]comcast.net> wrote in message news:3A9A713D-DF19-4E86-8C1F-07DC932BE752[ at ]microsoft.com...
> > Sue,
> > OK...I understand that the list box after being filled is not persistent
> > when the contact is saved and would have to be refilled each time the contact
> > is opened to see the intended content of the list-box.
> > But it appears to me that the Categories that are created in the Master
> > Category file and then checked by the user when setting up a contact ARE
> > persistent...both the category assigned and the check box are visible again
> > when the saved contact is re-opened. If I can't do what I want to do with a
> > list-box, is there a way I can replicate the Categories capability with code
> > and accomplish what I want to do via the establishment of categories?
> > --
> > John E.
> >
> >
> > "Sue Mosher [MVP-Outlook]" wrote:
> >
> >> >> fill an identical lstVisitRequests
> >> > list box in each objItem as they are being walked thru by the rest of the
> >> > code within the For Each...EndIf loop
> >>
> >> What you want to do is not possible. Changes to an item's UI -- such as filling a list box -- are not persisted when the item is saved. Filling the list box is an operation that needs to take place in the Item_Open event handler on your form.
> >>
> >> "John E." <je.lodestar[ at ]comcast.net> wrote in message news:3E202DDE-8951-4338-B0FF-EF1C915065EC[ at ]microsoft.com...
> >> > Sue,
> >> > The line... lstVisitRequests.List() = arrVisitRequests ....reads the array
> >> > data into a list box that is resident in the form that is part of my VBA
> >> > session and works fine. This is really there to test my read process and
> >> > feed process to the list box.
> >> > The line....m_objItem.lstVisitRequests = Join(arrVisitRequests, ",").....is
> >> > what I am really trying to do, which is fill an identical lstVisitRequests
> >> > list box in each objItem as they are being walked thru by the rest of the
> >> > code within the For Each...EndIf loop. This list box has identical
> >> > properties to the one in the test form referenced above, but resides on the
> >> > 1st page of the custom form for each contact. Using the Watch feature I
> >> > have confirmed that this For Each loop is working properly to walk thru each
> >> > contact in the folder. My problem is I can't figure out how to get the
> >> > arrVisitRequest data into the list box contained in each objItem list box.
> >> >
> >> > --
> >> > John E.
> >> >
> >> >
> >> > "Sue Mosher [MVP-Outlook]" wrote:
> >> >
> >> >> If you already have this statement:
> >> >>
> >> >> lstVisitRequests.List() = arrVisitRequests
> >> >>
> >> >> I don't understand the purpose of this one:
> >> >>
> >> >> m_objItem.lstVisitRequests = Join(arrVisitRequests, ",")
> >>
> >> >> "John E." <je.lodestar[ at ]comcast.net> wrote in message news:9BC4BDD5-5AE2-40B4-81D9-729051A5E277[ at ]microsoft.com...
> >> >> >I have a custom form for Contacts that has a list box on the 1st page into
> >> >> > which I am reading data from an Excel spreadsheet. Was trying to use the
> >> >> > Join function to do this per pgs 108-109 of Sue's book but can't get past a
> >> >> > run time error on the line that has comment relative to
> >> >> > objItem.lstVisitRequest list box in below code. Can anyone advise me why
> >> >> > this isn't working? Run time error given for this line is #5: Invalid
> >> >> > procedure call or argument, yet it is done in same way as Sue's book.
> >> >> > intRowCount = objRange.Rows.Count
> >> >> > If intRowCount > 0 Then
> >> >> > For Each m_objItem In m_objCurrentFolder.Items
> >> >> > m_strCategories = m_objItem.Categories
> >> >> > If InStr(m_strCategories, "International") > 0 Then
> >> >> > lstVisitRequests.ColumnCount = 4
> >> >> > Dim arrVisitRequests(ListBoxRows, 3)
> >> >> > Dim arrList(ListBoxRows, 3)
> >> >> > For I = 0 To intRowCount
> >> >> > arrVisitRequests(I, 0) = objRange.Cells(I + 1, 1)
> >> >> > arrVisitRequests(I, 1) = objRange.Cells(I + 1, 2)
> >> >> > arrVisitRequests(I, 2) = objRange.Cells(I + 1, 3)
> >> >> > arrVisitRequests(I, 3) = objRange.Cells(I + 1, 4)
> >> >> > Next
> >> >> > ' Fill the List Box from the loaded array.
> >> >> > lstVisitRequests.List() = arrVisitRequests
> >> >> > ' Fill the List Box in the current contact item
> >> >> > m_objItem.lstVisitRequests = Join(arrVisitRequests, ",")
> >> >> > ' above line has run time error
> >> >> > m_objItem.Save
> >> >> > End If
> >> >> > Next
> >> >> > End If
> >> >> > --
> >> >> > John E.
> >> >>
> >>
>