Paul Hartland (ISHARP)
paul.hartland at isharp.co.uk
Mon Nov 21 08:34:20 CST 2005
I didn't think I did either I had the following code: For intFolderCount = 1 To objInterview.Items.Count Set objMail = objInterview.Items.Item(intFolderCount) If (objMail.UnRead = True) Then intNewItems = intNewItems + 1 frmMain.txtNewText.Text = intNewItems strSubject = objMail.Subject If (strOffice = "") Then strOffice = Mid(strSubject, (InStrRev(strSubject, " ") + 1)) strMessage = Mid(objMail.Body, InStr(objMail.Body, "Message:")) End If MsgBox strOffice & vbCrLf & vbCrLf & strMessage strOffice = "" objMail.UnRead = False End If Next intFolderCount And when it's gets to the strMessage = Mid(objMail.Body, InStr(objMail.Body, "Message:")) It throws the Outlook security warning up, thought it would only do this if trying to send -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Andy Lacey Sent: 21 November 2005 13:04 To: Access Developers discussion and problem solving Subject: Re: [AccessD] OT - Access Using Outlook Redemption Hi Paul Well I'm not convinced you need Redemption just to read emaisl, but assuming you have other reasons why you need to use it then try: Dim objOutlook As Outlook.Application Dim objOutlookMsg As Outlook.MailItem Dim objOutlookFolder As MAPIFolder Dim objOutlookNameSpace As Outlook.NameSpace Dim objSafeMailItem As Object Set objOutlook = CreateObject("Outlook.Application") Set objOutlookNameSpace = objOutlook.GetNamespace("MAPI") Set objOutlookFolder = objOutlookNameSpace.GetDefaultFolder(olFolderInbox) For Each objOutlookMsg In objOutlookFolder.Items Set objSafeMailItem = CreateObject("Redemption.SafeMailItem") objSafeMailItem.Item = objOutlookMsg With objSafeMailItem If .UnRead Then Debug.Print .Subject Debug.Print .Body End If End With Next -- Andy Lacey http://www.minstersystems.co.uk --------- Original Message -------- From: "Access Developers discussion and problem solving" <accessd at databaseadvisors.com> To: "'Access Developers discussion and problem solving'" <accessd at databaseadvisors.com> Subject: [AccessD] OT - Access Using Outlook Redemption Date: 21/11/05 12:08 To all, Can anyone guide me or has anyone got any sample code for using Outlook redemption via Access, basically all I want to do is scan an Outlook folder for Unread emails and grab the subject line and the body message of that particular email. Thanks in advance for any help and/or sample code on this.. Paul Hartland -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com ________________________________________________ Message sent using UebiMiau 2.7.2 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com