L
lizcole
I have sucessfully done this on a custom form and it works
on my system but does not work at the client's site. I'm
using vbscript:
Sub Item_Open()
' Sets FormPage equal to the page ("Visit Report")
Set FormPage = Item.GetInspector.ModifiedFormPages
("Visit Report")
' Sets Control to a ListBox called cboContacts
Set Control = FormPage.Controls("cboContacts")
' Assign values to the ComboBox from Outlook Contacts
' Sets an object for the application
Set olns = Application.Session
' Get the default Contacts folder
Set ConFolder = olns.GetDefaultFolder(10)
' Get the items in the folder
Set ConItems = ConFolder.Items
' Get the total items in the Contacts folder
NumItems = ConItems.Count
' Resize array to handle total no. of folder items
ReDim FullArray(NumItems-1,2)
' Loop through the items in the Contacts folder,
' filling the array with data and keeping track
' of the number of contacts found.
NumContacts = 0
For I = 1 to NumItems
Set itm = ConItems(I)
NumContacts = NumContacts + 1
FullArray(NumContacts-1,0) = itm.fullname
FullArray(NumContacts-1,1) =
itm.CompanyName
Next
' Set the control to handle 2 data columns
Control.ColumnCount = 2
' Populate the combobox
Control.List() = FullArray
End Sub
If I use a msgbox statement to display the folder name it
works but whenever I try to display a field from the first
itm even the msgbox doesn't display. Does my client have
a dll missing or some other essential setting etc?
Cheers
Liz
on my system but does not work at the client's site. I'm
using vbscript:
Sub Item_Open()
' Sets FormPage equal to the page ("Visit Report")
Set FormPage = Item.GetInspector.ModifiedFormPages
("Visit Report")
' Sets Control to a ListBox called cboContacts
Set Control = FormPage.Controls("cboContacts")
' Assign values to the ComboBox from Outlook Contacts
' Sets an object for the application
Set olns = Application.Session
' Get the default Contacts folder
Set ConFolder = olns.GetDefaultFolder(10)
' Get the items in the folder
Set ConItems = ConFolder.Items
' Get the total items in the Contacts folder
NumItems = ConItems.Count
' Resize array to handle total no. of folder items
ReDim FullArray(NumItems-1,2)
' Loop through the items in the Contacts folder,
' filling the array with data and keeping track
' of the number of contacts found.
NumContacts = 0
For I = 1 to NumItems
Set itm = ConItems(I)
NumContacts = NumContacts + 1
FullArray(NumContacts-1,0) = itm.fullname
FullArray(NumContacts-1,1) =
itm.CompanyName
Next
' Set the control to handle 2 data columns
Control.ColumnCount = 2
' Populate the combobox
Control.List() = FullArray
End Sub
If I use a msgbox statement to display the folder name it
works but whenever I try to display a field from the first
itm even the msgbox doesn't display. Does my client have
a dll missing or some other essential setting etc?
Cheers
Liz