SUB folder in outlook inbox

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

Re: SUB folder in outlook inbox

Post by sal21 »

HansV wrote:Wouldn't it be easier to select the e-mail in Outlook itself and run a macro to save the attachment?

Hans very, very destroyed!

I have maked a test with:

Set olItm = olFld.Items.Restrict("[ReceivedTime]='07/04/2011 10:19'")

and the code work perfect!

But if i use:

dteLastCheck ="07/04/2011 10:19"

Set olItm = olFld.Items.Restrict("[ReceivedTime]='" & dteLastCheck & "')

the code not found the email!!!!!!!!!!

peraphs is a prob with " ' in the string when encapsuled the var dteLastCheck ????

note:
dteLastCheck is dimensioned Date

User avatar
HansV
Administrator
Posts: 78487
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: SUB folder in outlook inbox

Post by HansV »

Try declaring dteLastCheck as a String instead of a Date.

Or use

Set olItm = olFld.Items.Restrict("[ReceivedTime]='" & Format(dteLastCheck, "dd/mm/yyyy hh:mm") & "'")
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

Re: SUB folder in outlook inbox

Post by sal21 »

HansV wrote:Sorry, I don't know how to search for the subject of an e-mail.
About this:

criteria = "@SQL=" & Chr(34) _
& "urn:schemas:httpmail:subject" & Chr(34) _
& " like '%test%'"
Set olItm = olFld.Items.Restrict(criteria)

for shearing :grin: :smile:

http://msdn.microsoft.com/en-us/library ... 12%29.aspx
Last edited by sal21 on 16 Apr 2011, 11:20, edited 1 time in total.

User avatar
HansV
Administrator
Posts: 78487
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: SUB folder in outlook inbox

Post by HansV »

Thanks!
Best wishes,
Hans