T
Tony Epton
<already multiposted to microsoft.public.outlook (no response)>
I receive many email requests to scan old computer museum manuals to
pdf.
I manually paste fields from the emails in to a Microsoft Access table
of scan requests to keep track of everything.
I haven't done this since 18th Jan 2006 and i'm attempting to automate
the process to some extent to catch up.
Here is the code I've done so far:
---------------------------------------------------------------------------------
Dim lngCount As Long
Dim lngIndex As Long
Dim dteReceived As Date
Dim rs As Recordset
DoCmd.SetWarnings False
DoCmd.OpenQuery "qdelScanRequestEmails"
DoCmd.SetWarnings True
Set rs = CurrentDb().OpenRecordset("ScanRequestEmails")
Set myOlApp = CreateObject("Outlook.Application", "localhost")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set MyFolder = myNamespace.GetDefaultFolder(olFolderInbox)
lngCount = MyFolder.Items.count
For lngIndex = lngCount To 1 Step -1
Set MyItem = MyFolder.Items(lngIndex)
dteReceived = MyItem.ReceivedTime
If DateValue(dteReceived) < #1/18/2006# Then Exit For
rs.AddNew
rs![TimeReceived] = dteReceived
rs![Subject] = MyItem.Subject
rs![Body] = MyItem.Body
rs![SenderName] = MyItem.SenderName
rs![SenderEmail] = MyItem.ReplyRecipientNames
rs.Update
Next lngIndex
rs.Close
Set rs = Nothing
----------------------------
1) This finds items in my Outlook inbox, how can I point to my Outlook
Express inbox instead.
2) I am not correctly picking up the senders email (return address) -
which property of the mail item should I be using ? I've tried a
number of obvious ones -
for example - if I try
rs![SenderEmail] = MyItem.ReplyRecipients
then I get error "one or more parameter values are not valid"
Many thanks in advance
Tony Epton
I receive many email requests to scan old computer museum manuals to
pdf.
I manually paste fields from the emails in to a Microsoft Access table
of scan requests to keep track of everything.
I haven't done this since 18th Jan 2006 and i'm attempting to automate
the process to some extent to catch up.
Here is the code I've done so far:
---------------------------------------------------------------------------------
Dim lngCount As Long
Dim lngIndex As Long
Dim dteReceived As Date
Dim rs As Recordset
DoCmd.SetWarnings False
DoCmd.OpenQuery "qdelScanRequestEmails"
DoCmd.SetWarnings True
Set rs = CurrentDb().OpenRecordset("ScanRequestEmails")
Set myOlApp = CreateObject("Outlook.Application", "localhost")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set MyFolder = myNamespace.GetDefaultFolder(olFolderInbox)
lngCount = MyFolder.Items.count
For lngIndex = lngCount To 1 Step -1
Set MyItem = MyFolder.Items(lngIndex)
dteReceived = MyItem.ReceivedTime
If DateValue(dteReceived) < #1/18/2006# Then Exit For
rs.AddNew
rs![TimeReceived] = dteReceived
rs![Subject] = MyItem.Subject
rs![Body] = MyItem.Body
rs![SenderName] = MyItem.SenderName
rs![SenderEmail] = MyItem.ReplyRecipientNames
rs.Update
Next lngIndex
rs.Close
Set rs = Nothing
----------------------------
1) This finds items in my Outlook inbox, how can I point to my Outlook
Express inbox instead.
2) I am not correctly picking up the senders email (return address) -
which property of the mail item should I be using ? I've tried a
number of obvious ones -
for example - if I try
rs![SenderEmail] = MyItem.ReplyRecipients
then I get error "one or more parameter values are not valid"
Many thanks in advance
Tony Epton