Assign Categories to Mail via Macro

  • Thread starter Thread starter KdBrown
  • Start date Start date
K

KdBrown

I am looking for a way to assign categories to emails
through a macro. I can currently select several emails in
my inbox, then right click and select categories, then
select the category I want, but what I would like to do is
create a macro which I can place in a toolbar. When I
select items in my inbox, I would then go to the toolbar,
and select the correct button to assign them to the
appropriate category.

Can this be done?

Thanks,
KdBrown
 
Yes. For a macro you'd use Application.ActiveExplorer to get the
current folder. The Selection collection of that Explorer has all your
selected items. So the body of the code would look something like
this:

Dim oSel As Outlook.Selection
Dim oMail As Outlook.Mailitem

Set oSel = Application.ActiveExplorer.Selection
For Each oMail In oSel
oMail.Categories = "my category"
oMail.Save
Next
 
Ken,

Thanks, that worked great. I had been searching high and
low for two weeks for that.

KdBrown
 
Back
Top