Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / April 2008

Tip: Looking for answers? Try searching our database.

Add value to public contacts

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lp12 - 27 Apr 2008 14:37 GMT
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
Michael Bauer [MVP - Outlook] - 28 Apr 2008 07:10 GMT
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.

Signature

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:

> 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
Lp12 - 28 Apr 2008 07:52 GMT
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

> 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
[quoted text clipped - 5 lines]
> > What is the best practice to do so?
> > Thanks a lot
Lp12 - 28 Apr 2008 09:17 GMT
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

> Thanks a lot Michael,
> Here is the code I'm trying to run (I'm a newbie in Outlook programming):
[quoted text clipped - 21 lines]
> > > What is the best practice to do so?
> > > Thanks a lot
Sue Mosher [MVP-Outlook] - 28 Apr 2008 13:46 GMT
You need to call objContact.Save to make the change permanent.

Signature

Sue Mosher, Outlook MVP
  Author of Microsoft Outlook 2007 Programming:
    Jumpstart for Power Users and Administrators
   http://www.outlookcode.com/article.aspx?id=54

> An Update,
> I succeed in running the below code but when I look @ the contact list
[quoted text clipped - 34 lines]
>> > > What is the best practice to do so?
>> > > Thanks a lot
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.