E
Ed Stevens
Platform: Win2k, Outlook 2000, Excel 2000
I have been searching this ng's archives looking for a solution to my
problem, but the closest I've come is some out-of-context snippets that
assume more knowledge than I have. Being somewhat inexperienced with
VB and totally new to the Outlook object library, I am looking for some
direct assistance.
I am working on a macro in Excel to populate a worksheet with data
parsed out of mail messages. The source mail folder contains a lot of
items I will not want to deal with and would like to filter out based
on information supplied at run-time. Currently I am doing this
'manually' by each mail item in the folder and examining it, but this
is a waste of a lot of cycles, making it painfully slow, so I am
looking for a way to get a 'pre-selected' collection.
Here is what I have so far:
'=========== begin code sample ===============
Sub Main()
Dim golApp As Outlook.Application
Dim gnspNameSpace As Outlook.NameSpace
Dim fldr As Outlook.MAPIFolder
Dim olmail As MailItem
Dim strCriteria As String
Set golApp = New Outlook.Application
Set gnspNameSpace = golApp.GetNamespace("MAPI")
Set fldr = gnspNameSpace.PickFolder
strCriteria = UCase(InputBox("Which database?"))
For Each olmail In fldr.Items
-- code to determine if I want to work with this mail item
-- i.e. instr(olmail.subject,strCriteria) > 0
-- code to parse the item and populate the Excel worksheet
Next olmail
'=========== end code sample ===============
Only about 10% to 15% of the mail items in the folder will meet my
criteria, so it would be very helpful to be able to work with a
collection that was pre-selected on the value of strCriteria.
Thanks for any asisstance.
I have been searching this ng's archives looking for a solution to my
problem, but the closest I've come is some out-of-context snippets that
assume more knowledge than I have. Being somewhat inexperienced with
VB and totally new to the Outlook object library, I am looking for some
direct assistance.
I am working on a macro in Excel to populate a worksheet with data
parsed out of mail messages. The source mail folder contains a lot of
items I will not want to deal with and would like to filter out based
on information supplied at run-time. Currently I am doing this
'manually' by each mail item in the folder and examining it, but this
is a waste of a lot of cycles, making it painfully slow, so I am
looking for a way to get a 'pre-selected' collection.
Here is what I have so far:
'=========== begin code sample ===============
Sub Main()
Dim golApp As Outlook.Application
Dim gnspNameSpace As Outlook.NameSpace
Dim fldr As Outlook.MAPIFolder
Dim olmail As MailItem
Dim strCriteria As String
Set golApp = New Outlook.Application
Set gnspNameSpace = golApp.GetNamespace("MAPI")
Set fldr = gnspNameSpace.PickFolder
strCriteria = UCase(InputBox("Which database?"))
For Each olmail In fldr.Items
-- code to determine if I want to work with this mail item
-- i.e. instr(olmail.subject,strCriteria) > 0
-- code to parse the item and populate the Excel worksheet
Next olmail
'=========== end code sample ===============
Only about 10% to 15% of the mail items in the folder will meet my
criteria, so it would be very helpful to be able to work with a
collection that was pre-selected on the value of strCriteria.
Thanks for any asisstance.