![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
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").Fo lders("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 |
#2
|
|||
|
|||
![]()
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. mrdonofrio wrote: 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").Fo lders("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 |
#3
|
|||
|
|||
![]()
The search string is in the wrong format:
Set objItem = colItems.Find("[Location] = ""99999999999""") -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "mrdonofrio" wrote: 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").Fo lders("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 |
#4
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to Find a Item using VBScript in Outlook/Exchange | Andrew Sampels | Outlook - Using Forms | 5 | August 8th 06 10:54 PM |
How do I delete a saved calendar location? | Cherisse | Outlook - Calandaring | 1 | June 21st 06 05:28 AM |
Display location in Calendar | Melanie | Outlook - Calandaring | 0 | February 1st 06 05:10 PM |
How to find out which is the current item shown in the inspector? | Michael Reukauff | Add-ins for Outlook | 1 | January 25th 06 03:33 PM |
How to find Appointment Item by EntryID? | deko | Outlook and VBA | 2 | January 23rd 06 08:15 PM |