J
John Riddle
Hello,
Does anyone know if I could populate an array with Outlook items such as:
Dim myArray()
Dim myItem As MailItem 'Or Object?
Dim myItems As Outlook.Items
Set myItems = Application.Session.GetDefaultFolder(olFolderInboxItems).Items
i = 0
For Each myItem in MailItems
ReDim myArray(i)
Set myArray(i) = myItem.Item
i = i +1
Next
Set oItem = myArray(3) 'assuming that there are several items in the array
oItem.Display
This is a very simplified example. Obviously, without a restriction on the
MailItems I could just use the index of the MailItems collection to retrieve
the item and not bother with the array at all. What I'm actually doing is
using the Find/FindNext methods to populate an array with items themselves
instead of just some properties of the items.
Can this be done?
Thanks,
John
Does anyone know if I could populate an array with Outlook items such as:
Dim myArray()
Dim myItem As MailItem 'Or Object?
Dim myItems As Outlook.Items
Set myItems = Application.Session.GetDefaultFolder(olFolderInboxItems).Items
i = 0
For Each myItem in MailItems
ReDim myArray(i)
Set myArray(i) = myItem.Item
i = i +1
Next
Set oItem = myArray(3) 'assuming that there are several items in the array
oItem.Display
This is a very simplified example. Obviously, without a restriction on the
MailItems I could just use the index of the MailItems collection to retrieve
the item and not bother with the array at all. What I'm actually doing is
using the Find/FindNext methods to populate an array with items themselves
instead of just some properties of the items.
Can this be done?
Thanks,
John