A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

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



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old September 8th 08, 10:37 PM posted to microsoft.public.outlook.program_vba
jimboluke
external usenet poster
 
Posts: 13
Default How to use macro (OL2007) to assign categories to group of message

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
Ads
  #2  
Old September 9th 08, 08:02 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default How to use macro (OL2007) to assign categories to group of message



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:

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

  #3  
Old September 9th 08, 04:23 PM posted to microsoft.public.outlook.program_vba
jimboluke
external usenet poster
 
Posts: 13
Default How to use macro (OL2007) to assign categories to group of mes

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

"Michael Bauer [MVP - Outlook]" wrote:



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

  #4  
Old September 9th 08, 05:19 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default How to use macro (OL2007) to assign categories to group of mes



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:

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

"Michael Bauer [MVP - Outlook]" wrote:



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

Save
method.

  #5  
Old September 9th 08, 07:45 PM posted to microsoft.public.outlook.program_vba
jimboluke
external usenet poster
 
Posts: 13
Default How to use macro (OL2007) to assign categories to group of mes

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

"Michael Bauer [MVP - Outlook]" wrote:



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:

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

"Michael Bauer [MVP - Outlook]" wrote:



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

Save
method.


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to assign category to new email [email protected] Outlook - General Queries 7 July 30th 08 11:18 PM
updated to 2007 and can't assign colors to exisiting categories Candace Outlook - Using Contacts 1 October 7th 07 09:22 AM
can't assign macro [email protected] Outlook and VBA 1 July 24th 07 03:23 PM
Categories auto assign baileyalexander Outlook - Calandaring 2 March 25th 07 02:23 AM
assign macro to custom toolbar button Rod Nolan Outlook and VBA 1 September 7th 06 06:34 AM


All times are GMT +1. The time now is 08:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.