Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What I'm trying to do is access my outlook inbox and grab all unread
emails, received today, with subject containing "string here". After grabbing I'm placing tab delimited data in Excel. The above works fine almost (I'm unable to limit to just unread) The following is where it's breaking. Next I need to move processed emails to another folder. When I run this macro - which I built based on code from this group. The code is loading the emails I expect into Excel but it's moving all unread emails to another folder. I only want the items I process that met first series of condition Thoughts Steve **** Start Code **** Sub GetTradeSignal() On Error Resume Next Dim olApp As Outlook.Application Dim olNs As NameSpace Dim Fldr As MAPIFolder Dim olMail As Variant Dim sStr As String Dim arr As Variant Dim i As Integer Dim x As Long Set olApp = New Outlook.Application Set olNs = olApp.GetNamespace("MAPI") Set Fldr = olNs.GetDefaultFolder(olFolderInbox) i = 1 For Each olMail In Fldr.Items If olMail.UnRead = True And _ InStr(olMail.Subject, "C2:Trade:") 0 And _ Int(olMail.ReceivedTime) = Date Then sStr = olMail.Body arr = Split(sStr, " ") x = UBound(arr) - LBound(arr) + 1 ActiveSheet.Cells(i, 1).Resize(1, x).Value = arr i = i + 1 End If olMail.UnRead = False olMail.Move Fldr.Folders("Archived") Next olMail Set Fldr = Nothing Set olNs = Nothing Set olApp = Nothing End Sub ****End CODE ***** |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Whats wrong with this code? | Excel Programming | |||
Whats Wrong with this?? | Excel Worksheet Functions | |||
Whats wrong with this line of code? | Excel Programming | |||
whats wrong with this code | Excel Programming | |||
Whats wrong with this code | Excel Programming |