Items.Find method and " symbol 
Author Message
 Items.Find method and " symbol

Hello,

I'm trying to use Items.Find method to find MailItem in my Inbox folder with
specific Subject. All works fine except when Subject contains " symbol.
For example I can find mail message with next subject:
    Hello from someone
with next code:
    sFilter = "[Subject]=""Hello from someone"""
    Set oItem = oItems.Find(sFilter)

But I can't find mail message with next subject:
Hello from "someone"

Could you please give me a clue?

Thanks,
Paul.



Tue, 12 Oct 2004 19:16:26 GMT  
 Items.Find method and " symbol
You would require separate searches, but you can use something like
this:
    strFilter =  "[Subject]=" & """someone"""

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


Quote:
> Hello,

> I'm trying to use Items.Find method to find MailItem in my Inbox
folder with
> specific Subject. All works fine except when Subject contains "
symbol.
> For example I can find mail message with next subject:
>     Hello from someone
> with next code:
>     sFilter = "[Subject]=""Hello from someone"""
>     Set oItem = oItems.Find(sFilter)

> But I can't find mail message with next subject:
> Hello from "someone"

> Could you please give me a clue?

> Thanks,
> Paul.



Tue, 12 Oct 2004 22:08:38 GMT  
 Items.Find method and " symbol
Ken,

thank you for your help but unfortunately your variant doesn't work. And
what do you mean "separate searches"? May be I described my problem not
clear enough due to my pure English, sorry.
The main problem for me is how to Find mail message with " in subject field.

Thanks again,
Paul.



Quote:
> You would require separate searches, but you can use something like
> this:
>     strFilter =  "[Subject]=" & """someone"""



Wed, 13 Oct 2004 08:43:45 GMT  
 Items.Find method and " symbol
That search example yields a search string of:
    [Subject]="someone"

That's what I thought you wanted. To just find a quote you can't use a
filter like that, since you would be searching using something like
the InStr function, which isn't supported. You would have to loop all
your items and use InStr to search the Subject fields of those items.
You can make that faster by using SetColumns "Subject" on the Items
collection before your search and ResetColumns afterwards.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


Quote:
> Ken,

> thank you for your help but unfortunately your variant doesn't work.
And
> what do you mean "separate searches"? May be I described my problem
not
> clear enough due to my pure English, sorry.
> The main problem for me is how to Find mail message with " in
subject field.

> Thanks again,
> Paul.



Fri, 15 Oct 2004 21:36:07 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Find method and " symbol

2. Finding "FIND" method

3. "Item could not be found"

4. SQL - finding "missing" items

5. SQL - finding "missing" items

6. "Method or data member not found"

7. the "Find" method in ADO

8. "Method Not Found" error

9. RichTextBox method "Find"

10. "Method Not Found" error

11. Field Names for Outlook Items Find Method

12. Creating Items collection using Find method instead of Restrict

 

 
Powered by phpBB® Forum Software