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

Code worked once only. then stopped.



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 28th 06, 06:52 PM posted to microsoft.public.outlook.program_vba
Carol G
external usenet poster
 
Posts: 25
Default Code worked once only. then stopped.

I am using Outlook 2000.



I am sure that this code worked once and then stopped working. It is meant
to update data to the outlook contactitem body from a button in an access
database. I check the outlook contact item and nothing is being transferred
into the body.

Any Ideas what I'm doing wrong?

Both strNameList and strNotes have the proper data in them.



Private Sub cmdOutlookExport_Click()



Dim strNameList as String

Dim strNotes as String



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



'Before being called Both strNameList and strNotes have the proper data in
them. This is 'checked in the For Each Loop below.





For Each itm In itms



If strNameList = itm.FullName Then

Debug.Print itm.FullName & " is found"

itm.Body = itm.Body & strNotes

Debug.Print itm.Body & " is itm.body"

End If

Next

MsgBox "Contact Updated Successfully"





Thanks

Carol


  #2  
Old November 28th 06, 07:39 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Code worked once only. then stopped.

Try saving the items as you modify them to persist the changes.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Carol G" wrote in message
news:rz%ah.385095$5R2.91170@pd7urf3no...
I am using Outlook 2000.



I am sure that this code worked once and then stopped working. It is meant
to update data to the outlook contactitem body from a button in an access
database. I check the outlook contact item and nothing is being
transferred
into the body.

Any Ideas what I'm doing wrong?

Both strNameList and strNotes have the proper data in them.



Private Sub cmdOutlookExport_Click()



Dim strNameList as String

Dim strNotes as String



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



'Before being called Both strNameList and strNotes have the proper data in
them. This is 'checked in the For Each Loop below.





For Each itm In itms



If strNameList = itm.FullName Then

Debug.Print itm.FullName & " is found"

itm.Body = itm.Body & strNotes

Debug.Print itm.Body & " is itm.body"

End If

Next

MsgBox "Contact Updated Successfully"





Thanks

Carol



  #3  
Old November 28th 06, 07:57 PM posted to microsoft.public.outlook.program_vba
Carol G
external usenet poster
 
Posts: 25
Default Code worked once only. then stopped.

Do you mean? .Close (olSave)??
I am pretty new to outlook so I'm not sure if this is what you meant.
Thanks
Carol
"Ken Slovak - [MVP - Outlook]" wrote in message
...
Try saving the items as you modify them to persist the changes.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Carol G" wrote in message
news:rz%ah.385095$5R2.91170@pd7urf3no...
I am using Outlook 2000.



I am sure that this code worked once and then stopped working. It is

meant
to update data to the outlook contactitem body from a button in an

access
database. I check the outlook contact item and nothing is being
transferred
into the body.

Any Ideas what I'm doing wrong?

Both strNameList and strNotes have the proper data in them.



Private Sub cmdOutlookExport_Click()



Dim strNameList as String

Dim strNotes as String



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



'Before being called Both strNameList and strNotes have the proper data

in
them. This is 'checked in the For Each Loop below.





For Each itm In itms



If strNameList = itm.FullName Then

Debug.Print itm.FullName & " is found"

itm.Body = itm.Body & strNotes

Debug.Print itm.Body & " is itm.body"

End If

Next

MsgBox "Contact Updated Successfully"





Thanks

Carol





  #4  
Old November 28th 06, 08:02 PM posted to microsoft.public.outlook.program_vba
Carol G
external usenet poster
 
Posts: 25
Default Code worked once only. then stopped.

Thank you, that worked.
Carol
"Ken Slovak - [MVP - Outlook]" wrote in message
...
Try saving the items as you modify them to persist the changes.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Carol G" wrote in message
news:rz%ah.385095$5R2.91170@pd7urf3no...
I am using Outlook 2000.



I am sure that this code worked once and then stopped working. It is

meant
to update data to the outlook contactitem body from a button in an

access
database. I check the outlook contact item and nothing is being
transferred
into the body.

Any Ideas what I'm doing wrong?

Both strNameList and strNotes have the proper data in them.



Private Sub cmdOutlookExport_Click()



Dim strNameList as String

Dim strNotes as String



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



'Before being called Both strNameList and strNotes have the proper data

in
them. This is 'checked in the For Each Loop below.





For Each itm In itms



If strNameList = itm.FullName Then

Debug.Print itm.FullName & " is found"

itm.Body = itm.Body & strNotes

Debug.Print itm.Body & " is itm.body"

End If

Next

MsgBox "Contact Updated Successfully"





Thanks

Carol





  #5  
Old November 28th 06, 08:51 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Code worked once only. then stopped.

Actually I was thinking more of itm.Save in the loop after you modify each
contact item.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Carol G" wrote in message
news:sB0bh.382124$1T2.203646@pd7urf2no...
Thank you, that worked.
Carol


 




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
How can I calculate hours worked from Outlook Calendar? Victoria R Outlook - Calandaring 1 March 30th 07 05:46 PM
hotsync for palm calenda worked initially - not since! austin and hotsync Outlook - Calandaring 1 November 19th 06 05:08 PM
add 1+XXX area code to phone nr in my area code OH Outlook - Using Contacts 3 August 3rd 06 03:45 PM
no send button on outlook 2003 nothing tried has worked gwertime Outlook - General Queries 2 January 27th 06 03:18 PM
Backup worked before update Kathleen Outlook - Installation 2 January 11th 06 06:22 PM


All times are GMT +1. The time now is 12:21 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.