Outlook & VB Problem
Posted on 2003-03-12
I'm trying put in only one e-mail, the one with the matching subject and body. To do this i'm passing the function the subject and body and they are called pSubject and pBody.
'Set mr = Inbox.Items.Restrict("[Subject] = '" & pSubject & "' AND [Body] = '" & pBody & "'")
Set mr = Inbox.Items.Restrict("[Subject] = '" & pSubject & "'")
The commentted out line is the one i really ant to use but the second one is for testing and this one doesn't work.
It works IF the subject passed in pSubject contains no single quotes '
As soon as a single quote appears it dies.
What i'm looing for is, is there some way of escaping the ' here '" & pSubject & "'. I know in perl i would just simplely \' and it would work but i can't figure out a way of doing it here.