Microsoft KB Archive/252947

= OL2000: How to Programmatically Set Journaling for All Contacts =

Article ID: 252947

Article Last Modified on 11/23/2006

-

APPLIES TO


 * Microsoft Outlook 2000 Standard Edition

-



This article was previously published under Q252947



SUMMARY
This article provides an Outlook Visual Basic for Applications macro that you can use to programmatically change all of your contacts so that they are automatically set to journal.



MORE INFORMATION
The default setting for journaling contact items is disabled. If you create contacts and then decide to enable journaling for these contacts, set the journal option for each contact:
 * 1) On the Tools menu, click Options.
 * 2) On the Preferences tab, click Journal Options.
 * 3) In the For these contacts box, click each contact for which you want to enable journaling.

If you have a large number of contacts and you want to enable journaling for all of them, it may be more efficient to programmatically change all of the contacts.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

To create the macro:  On the Tools menu, point to Macro, and then click Macros. In the Macro Name box, type SetAllContactsToJournal, and then click Create. The Visual Basic Editor starts and automatically creates a subroutine for you.  Type the following lines of code: Sub SetAllContactsToJournal

Dim objContactsFolder As Outlook.MAPIFolder Dim objContacts As Outlook.Items Dim objContact As Object Dim iCount As Integer

' Specify which contact folder to work with Set objContactsFolder = Session.GetDefaultFolder(olFolderContacts) Set objContacts = objContactsFolder.Items

iCount = 0

' Process the changes For Each objContact In objContacts If TypeName(objContact) = "ContactItem" Then If objContact.Journal = False Then objContact.Journal = True objContact.Save iCount = iCount + 1 End If     End If   Next MsgBox "Number of contacts updated:" & Str$(iCount)

' Clean up  Set objContact = Nothing Set objContacts = Nothing Set objContactsFolder = Nothing

End Sub  On the File menu, click Close and Return to Microsoft Outlook.

To use the macro:
 * 1) On the Tools menu, point to Macro, and then click Macros.
 * 2) Click SetAllContactsToJournal, and then click Run.

A window appears that tells you the number of contacts that were updated.