Find Calendar Item from Location

M

mrdonofrio

Hi

I have read the posts regarding finding by location - i can get my code
to work by looping through each item until i get to the correct record
however i cannot get the code to the record.

I am probably missing something vey simple but cannot get this to work.

Thank in advance



Public Function OutLookCode()

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.Folders("Public Folders").Folders("All
Public Folders").Folders("RRES Public
Folders").Folders("ROTH").Folders("Facilities").Folders("Conference
Centre").Folders("Elliott Suite")
Set colItems = objFolder.Items

strTest = colItems.Count

Set objItem = colItems.Find(Location = "99999999999") '****** This line
does not work and returns the error 'Condition not valid'


******** This works fine if the above is comented out
For Each objItem In colItems
If objItem.Location = "99999999999" Then
With objItem
strTest = objItem.Subject
End With
End If
Next

End Function
 
M

mrdonofrio

Sorry this should have read

I have read the posts regarding finding by location - i can get my code
to work by looping through each item until i get to the correct record
however i cannot get the code to FIND the record.
 
E

Eric Legault [MVP - Outlook]

The search string is in the wrong format:

Set objItem = colItems.Find("[Location] = ""99999999999""")
 
M

mrdonofrio

Hi Eric

Thanks for that - you code actually came back with another error -
Uanble to parse condition. Error at ""99999999".

So i changed the code to this and it works perfectly

Set objItem = calItems.Find("[Location] =" & 999999999)

Thanks for your help - much appreciated

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top