OL2002: How to Programmatically Set Journaling for All Contacts

This article was previously published under Q294363
This article has been archived. It is offered "as is" and will no longer be updated.
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 Microsoft Advisory Services. For more information, visit these Microsoft Web sites:

Microsoft Certified Partners - https://partner.microsoft.com/global/30000104

Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice

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;CNTACTMSTo create the macro:
  1. On the Tools menu, point to Macro, and then click Macros.
  2. In the Macro Name box, type SetAllContactsToJournal, and then click Create. The Visual Basic Editor starts and automatically creates a subroutine for you.
  3. 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 = NothingEnd Sub					
  4. 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.

Notes

  • It may take a while to process the items in your Contacts folder.
  • When your contacts are being updated, your pointer does not change to an hourglass.
  • You can assign the macro to a button if you use this often.For additional information about assigning this macro to a toolbar button, click the article number below to view the article in the Microsoft Knowledge Base:
    292797 OL2002: How to Assign a Macro to a Toolbar Button
  • The sample code only works with the default Contacts folder. If you want it to work with any contacts folder, locate the following line of code
    Set objContactsFolder = Session.GetDefaultFolder(olFolderContacts)						
    and change it to:
    Set objContactsFolder = Outlook.ActiveExplorer.CurrentFolder					
  • If you are familiar with programming and want to use a specific contacts folder in a different location, see the following article in the Microsoft Knowledge Base:
290804 OL2002: Programming Examples for Referencing Items and Folders
References
For additional information about available resources and answersto commonly asked questions about Microsoft Outlook solutions, click the article number below to view the article in the Microsoft Knowledge Base:
287530 OL2002: Questions About Custom Forms and Outlook Solutions
OfficeKBHowTo OutSol OutSol2002
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.
Properties

Article ID: 294363 - Last Review: 10/25/2013 21:56:00 - Revision: 1.0

  • Microsoft Outlook 2002 Standard Edition
  • kbnosurvey kbarchive kbdswnet2003swept kbhowto KB294363
Feedback