Add value to public contacts

L

Lp12

Hi All,
I have to add my company name (under company field) to all employees
contacts (public folder).
What is the best practice to do so?
Thanks a lot
 
M

Michael Bauer [MVP - Outlook]

If there's something common to all of the employees you can use teh Restrict
function to get that collection. Then loop though it and change the Company
property.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool:
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Sun, 27 Apr 2008 06:37:00 -0700 schrieb Lp12:
 
L

Lp12

Thanks a lot Michael,
Here is the code I'm trying to run (I'm a newbie in Outlook programming):
Sub EditContacts()
Set myNameSpace = Application.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderContacts).items
Set myNewFolder = myFolder.Folders("Private Contacts")
Set MyItems = myNewFolder
For Each myitem In MyItems
CompanyName = "LADIDA LTD"
Next
End Sub

I'm getting error on third row and can't get past it.
Any thoughts?
Thanks again
 
L

Lp12

An Update,
I succeed in running the below code but when I look @ the contact list
afterwards I still see a blank "Company" property. How come?
thanks a lot

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")

Set colContacts = objNamespace.GetDefaultFolder(olFolderContacts).Items
For Each objContact In colContacts
objContact.CompanyName = "LADIDA LTD"
Next
 

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