A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

itm in itms folder question.



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3  
Old November 30th 06, 04:41 PM posted to microsoft.public.outlook.program_vba
Carol G
external usenet poster
 
Posts: 25
Default itm in itms folder question.

Sorry, Actually I had some code before this that checked that it is there to
find.
My problem is that if I place the With itm inside the for loop. When the
loop closes do I lose my itm.FullName which I wish to use out of the loop
with "With itm"? Hope that my question is making sense.
I just recently bought your book and am finding it helpful but I have a long
way to go.
Thanks

"Sue Mosher [MVP-Outlook]" wrote in message
...
You are missing any code to test whether itm really was found:

If Not itm Is Nothing Then
' update it
Else
'create it
End If

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Carol G" wrote in message
news:aTmbh.386356$1T2.195613@pd7urf2no...
I am wishing to capture the itm from the collection when it is found and
then overwrite the info using with itm.
If it is not found then I wish to set a new itm and add the info.
As the code to add or overwrite is the same I was hoping to just have it
written once.
I think it won't work this way because once I'm out of the for loop my itm
is gone.
I am very unsure of all this.
Thanks for any suggestions.
Carol

If strDecision = "0" Then
For Each itm In itms
If strNameList = itm.FullName Then
Debug.Print itm.FullName & " is found"
End If 'strNameList = itm.FullName
Exit For
Next
with itm **** Here is the problem***

Else ' if decision is new
Set itm = itms.Add

end if
'Then code for add ing record.
'Standard Contact fields
.CustomerID = strCustomerID
.FirstName = strFName1
.LastName = strLName1
.CompanyName = strCompName1
.User4 = strCompName2
...




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie question: How to copy an email item from inbox to a folder Marceepoo Outlook and VBA 1 November 1st 06 06:54 PM
Deleted Items folder question 3putt Outlook Express 4 July 4th 06 11:59 AM
Question about Default Contacts folder Mervin Williams Outlook - Using Contacts 5 April 13th 06 12:05 AM
Search Folder Question Please Bob Newman Outlook - General Queries 0 April 2nd 06 03:34 PM
.NET AddIn Question UserControl in Folder homepage David Ing Outlook and VBA 8 March 4th 06 12:24 PM


All times are GMT +1. The time now is 12:26 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.