How to use macro (OL2007) to assign categories to group of message


J

JIMBOLUKE

I am trying to make something happen in Outlook 2007 that was natural in
Outlook 2003. In OL 2003, I could expose the Categories field in a message
list and simply type in categories. I use hundreds of categories (instead of
folders), so the nice colorized popup category menu in OL2007 is actually too
inefficient for my purposes. I tried to hack a macro (below), which only
works on the first item of the selection. Was wondering what I could do to
make this work correctly/better?



' an attempt to quickset categories from an input box interface, something
' that I used to be able to do easily in Outlook2003
'
Public Sub SetCat()
Dim myOlApp As New Outlook.Application
Dim myOlExp As Outlook.Explorer
Dim myfolder As Outlook.MAPIFolder
Dim myOlSel As Object
Dim MsgTxt As String
Dim x As Integer
MsgTxt = InputBox("Enter Categories (comma separated)", "Macro to Set
Categories", "HOT")
Set myOlExp = myOlApp.ActiveExplorer
Set myOlSel = myOlExp.Selection
For x = 1 To myOlSel.count
myOlSel.Item(x).Categories = MsgTxt
Next x
DoEvents
End Sub
 
Ad

Advertisements

M

Michael Bauer [MVP - Outlook]

Before the loop moves on to the next item, you need to call the item's Save
method.

--
Best regards
Michael Bauer - MVP Outlook

: VBOffice Reporter for Data Analysis & Reporting
: Outlook Categories? Category Manager Is Your Tool
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Mon, 8 Sep 2008 13:37:01 -0700 schrieb JIMBOLUKE:
 
J

JIMBOLUKE

Thanks, I have a workable implementation now for a mass category entry tool!
I drug the macro onto the primary toolbar, renamed it to "&K" (which allows
me to activate it with "Alt-K"), and I'm off to the races. I'd like to
improve it further (like eliminating duplicates, having something that
actually autocompletes from a list of categories, etc), but I do have a
makeshift solution.


' SetCat() - 20080908a
'
' an attempt to quickset categories from an input box interface, something
' that I used to be able to do easily in Outlook2003
'
'
' routine simply appends a user-inputted string to the categories field
' but does not eliminate duplicates. OL2007 apparently doesn't prevent you
' from putting redundant categories
'
'
Public Sub SetCat()
Dim myOlApp As New Outlook.Application
Dim myOlExp As Outlook.Explorer
Dim myfolder As Outlook.MAPIFolder
Dim myOlSel As Object
Dim MsgTxt As String
Dim x As Integer
MsgTxt = InputBox("Enter Categories (comma separated)", "Macro to Set
Categories", "HOT")
Set myOlExp = myOlApp.ActiveExplorer
Set myOlSel = myOlExp.Selection
For x = 1 To myOlSel.count
If myOlSel.Item(x).Categories = "" Then
myOlSel.Item(x).Categories = MsgTxt
Else
myOlSel.Item(x).Categories = myOlSel.Item(x).Categories & "," &
MsgTxt
End If
myOlSel.Item(x).Save
Next x
DoEvents
End Sub
 
M

Michael Bauer [MVP - Outlook]

If you're interested in improving your work with categories, you might also
test Category Manager. For details and the free download please see the link
in my signature.

--
Best regards
Michael Bauer - MVP Outlook

: VBOffice Reporter for Data Analysis & Reporting
: Outlook Categories? Category Manager Is Your Tool
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Tue, 9 Sep 2008 07:23:01 -0700 schrieb JIMBOLUKE:
 
Ad

Advertisements

J

JIMBOLUKE

Thanks, looks like fun, but I don't have admin privileges (though I can run
risky macros) so it wouldn't install :( approval process takes forever.
darnit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top