I am trying to transfer emails to the deleted folder which is more than 21 days with "Xtremevbtalk" in the subject line Here are the code:
emptydeletedfolder () deferred oSource Outlook.MAPIFolder dim oTarget Outlook.MAPIFolder DueDate21days as dated as dated ItemsOverDays Outlook.Items dimDitToCheck string Date21days = as of dateADD ("d", -21, now ()) Date21days = format (Date21days, "dd / mm / yyyy") set oSource = Application.Session.GetDefaultFolder (olFolderDeletedItems) oTarget = oSource.Folders ( "_ old") DateToCheck = "[get] & lt; =" "" & amp; Date is 21 days & amp; "" "" Set ItemsOverDays = oSource.Items.Restrict (DateToCheck) i = 1 for ItemsOverDays.Count -1 for -1 if ItemsOverDays.Item (itm.Subject, "Xtremevbtalk") & gt; 0 Then ItemsOverDays.Item (i) .move oTarget from end to end, then set ItemsOverDays = nothing set oTarget = nothing set oSource = nothing End Sub I code As the step through, it fails less than the line: ItemsOverDays.Item (itm.Subject, "Xtremevbtalk")> 0 then
If the code runs fine without the statement, then all emails To delete 21 days of age, not sure how to write this line,
Try
P> If INSAT (items o Word (.) Subject, "Xtremevbtalk")> 0 then
Comments
Post a Comment