PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Assign Categories to Mail via Macro

Reply

Assign Categories to Mail via Macro

 
Thread Tools Rate Thread
Old 17-02-2004, 05:26 PM   #1
KdBrown
Guest
 
Posts: n/a
Default Assign Categories to Mail via Macro


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
  Reply With Quote
Old 17-02-2004, 09:21 PM   #2
Ken Slovak - [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: Assign Categories to Mail via Macro

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 Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginners Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"KdBrown" <anonymous@discussions.microsoft.com> wrote in message
news:121a901c3f57b$2ac238e0$a501280a@phx.gbl...
> 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



  Reply With Quote
Old 17-02-2004, 09:42 PM   #3
Guest
 
Posts: n/a
Default Re: Assign Categories to Mail via Macro

Ken,

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

KdBrown

>-----Original Message-----
>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 Slovak
>[MVP - Outlook]
>http://www.slovaktech.com
>Author: Absolute Beginners Guide to Microsoft Office

Outlook 2003
>Reminder Manager, Extended Reminders, Attachment Options
>http://www.slovaktech.com/products.htm
>
>
>"KdBrown" <anonymous@discussions.microsoft.com> wrote in

message
>news:121a901c3f57b$2ac238e0$a501280a@phx.gbl...
>> 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

>
>
>.
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off