Link to home
Start Free TrialLog in
Avatar of newparadigmz
newparadigmzFlag for United States of America

asked on

Excel VBA "Cannot Parse Condition." error message

I am running a VBA script that reads emails subject lines in my Outlook Inbox and copies attachments in the emails to a folder. The subject lines are stored on a worksheet. It works except when the subject line contains a ":". Below is the error message I get, the offending code, and the subject that it's breaking on.

Run-time error
Cannot Parse Condition. Error at ":".

    For i = 1 To UBound(avTable)
        strFilter = "[Subject] = " & avTable(i, 1)
        For Each itm In avTodayItems.Restrict(strFilter)            
             For Each att In itm.Attachments
                strFilename = LCase(att.Filename)
                If LCase(strFilename) = LCase(avTable(i, 2)) Then
                    att.SaveAsFile [nmFolder] & avTable(i, 3)
                End If
            Next att
        Next itm
    Next i

strFilter = "[Subject] = File 15.08.2012: Daily"
ASKER CERTIFIED SOLUTION
Avatar of Farzad Akbarnejad
Farzad Akbarnejad
Flag of Iran, Islamic Republic of image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of newparadigmz

ASKER

perfect!