Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


March 29, 2004

Outlook: Marking an Item with a Category


RSS
View this exclusive article with VIP access -- click here to join |
See More Exchange Server and Outlook Articles Here | Reprints | Or sign up for our VIP Monthly Pass!

Download the Code Here

Can I place a button in the toolbar that will assign a specific message category to an item with one click?

Sure, that's easy. Just place the code that Listing 2, page 6, shows in a regular module in Outlook Visual Basic for Applications (VBA). If you're just getting started with Outlook VBA, Outlook VBA on Demand, "Back to Basics," August 2001, InstantDoc ID 21522, explains how to set the macro security level, get into the VBA programming environment, and create your first macro. The article also explains how to add a macro as a toolbar button.

Here are a few notes about the code:

  • The MarkA and MarkB procedures both call the same MarkWithCategory procedure, but each assigns a different category to the selected item. You can make as many individual category macros like this as you need or even create a separate Categories toolbar to hold a toolbar button for each macro.
  • GetCurrentItem() is a function that returns either an item selected in a folder view or an individual open item. Thus, you can use the MarkA and MarkB procedures from either a folder or an item window. You can also reuse GetCurrentItem() in any macro that you write to work with a selected or open item.
  • The MarkWithCategory procedure always appends the new category to the existing Categories value for the item. It doesn't check whether the category is already present. I haven't experienced any problems with having a category listed twice, but you could refine the code to check the existing Categories value to see whether a category is already present before adding it.
  • The objItem.Categories = ... statement in MarkWithCategory assumes that you're in some part of the world that uses the comma as the default list separator. If you're in a country that uses the semicolon or other separator, you need to replace the comma with that separator.

End of Article



Reader Comments
Get a 404 error when trying to access VBA code

bmajerus May 24, 2007 (Article Rating: )


You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

How can I stop and start services from the command line?

...

PsExec

This freeware utility lets you execute processes on a remote system and redirect output to the local system. ...


Exchange Server and Outlook Whitepapers Protecting (You and) Your Data with Exchange Server 2007

StoreVault SnapManagers for Microsoft Exchange and SQL Server

Related Events Storage Consolidation for Your Microsoft Applications: Reducing Cost and Complexity

The Myths & Truths of Email Management with SharePoint

Top 10 Email Security Challenges and Solutions

Check out our list of Free Email Newsletters!

Exchange Server and Outlook eBooks Spam Fighting and Email Security for the 21st Century

Understanding and Leveraging Code Signing Technologies

The Expert's Guide for Exchange 2003: Preparing for, Moving to, and Supporting Exchange Server 2003

Related Exchange Server and Outlook Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.

Exchange & Outlook UPDATE eNewsletter
News, strategies, products, and developments in Exchange Server and Outlook messaging.

Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing