View Single Post
  #3  
Old December 2nd 06, 04:08 AM posted to microsoft.public.outlook.program_vba
Carol G
external usenet poster
 
Posts: 25
Default How do I Replace a string with a variable?

I think I also have a valid string but when I use it (or your version below)
I get a run time error saying.
Condition is not valid and a long number. Highlighting at my Set itm code.

Here is all my code. Any ideas? I have this code in a module in Access
2000. Just to test it.
Thanks Carol

Private Sub test()

Dim fld As Outlook.MAPIFolder
Dim appOutlook As Outlook.Application
Dim nms As Outlook.NameSpace
Dim itms As Outlook.Items
Dim itm As Outlook.ContactItem


Set appOutlook = CreateObject("Outlook.Application")
Set nms = appOutlook.GetNamespace("MAPI")
Set fld = nms.GetDefaultFolder(olFolderContacts) 'Set what kind of folder
Set itms = fld.Items 'Outlook folder item

Dim strFullName As String
strFullName = "Cherif Abdallah"
strFind = "[FullName] = " & Chr(34) & strFullName & Chr(34)


'strFullName = """" & "[FullName] = " & strFullName & """"
Debug.Print strFullName

Set itm = fld.Items.Find(strFullName)
'Debug.Print itm.LastName
'

End Sub



"Sue Mosher [MVP-Outlook]" wrote in message
...
strFind = "[FullName] = " & Chr(34) & strFullName & Chr(34)
Set itm = fld.Items.Find(strFind)


Ads