Solved

Outlook Categories Toolbar

Posted on 2010-09-03
15
476 Views
Last Modified: 2012-05-10
How can i create a toolbar which has all the categories as buttons (or a dropdown box since there are about 20 categories)
0
Comment
Question by:awesomejohn19
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 5
15 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 33599289
Hi, awesomejohn19.

What version of Outlook?
0
 

Expert Comment

by:brimac21
ID: 33599383
As far as I know this cannot be done in outlook natively. However there is a third party app called Category Manager 3.0 that will put all of your categories in a side-bar. You can try it for free for 30 days. http://www.vboffice.net/product.html?pub=20&lang=en&cmd=detail&id=2006063
0
 

Author Comment

by:awesomejohn19
ID: 33599384
Outlook 2003
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 76

Expert Comment

by:David Lee
ID: 33599419
This can be done with a simple bit of scripting.  Which do you prefer, buttons or a dropdown menu?
0
 

Author Comment

by:awesomejohn19
ID: 33599441
Buttons would be easier but the number of categories I would like to use is around 20 so I guess dropdown would be better.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 33599563
20 isn't too many if you prefer buttons.
0
 

Author Comment

by:awesomejohn19
ID: 33599569
ok than buttons would be great :)
0
 
LVL 76

Expert Comment

by:David Lee
ID: 33600507
One more question.  Do you plan to use this with messages you've received or with messages you're sending, or both?
0
 

Author Comment

by:awesomejohn19
ID: 33600544
received messages only
0
 
LVL 76

Assisted Solution

by:David Lee
David Lee earned 500 total points
ID: 33600603
The code comes in three parts.  This is part #1.

Follow these instructions to add the code to Outlook.

   1. Start Outlook
   2. Click Tools > Macro > Visual Basic Editor
   3. If not already expanded, expand Microsoft Office Outlook Objects
   4. Right-click on Class Modules, select Insert > Class Module
   5. In the Properties panel click on Name and enter CatBtn
   6. Copy the code and paste it into the right-hand pane of Outlook’s VB Editor window
   7. Click the diskette icon on the toolbar to save the changes
   8. Close the VB Editor

Private WithEvents objButton As Office.CommandBarButton
Private strThisCat As String

Private Sub Class_Terminate()
    Set objButton = Nothing
End Sub

Private Sub objButton_Click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean)
    Dim olkItm As Object, arrCats As Variant, varCat As Variant, bolFound As Boolean, intCnt As Integer, strNewCat As String
    Select Case TypeName(Outlook.Application.ActiveWindow)
        Case "Explorer"
            Set olkItm = Outlook.Application.ActiveExplorer.Selection(1)
        Case "Inspector"
            Set olkItm = Outlook.Application.ActiveInspector.CurrentItem
    End Select
    arrCats = Split(olkItm.Categories, ", ")
    For Each varCat In arrCats
        If varCat = strThisCat Then
            bolFound = True
        Else
            strNewCat = strNewCat & ", " & varCat
        End If
    Next
    If Not bolFound Then
        strNewCat = strNewCat & ", " & strThisCat
    End If
    olkItm.Categories = strNewCat
    olkItm.Save
    Set olkItm = Nothing
End Sub

Public Sub Init(ByRef ofcParentBar As Office.CommandBar, ByVal strCatNum As String, strTipText As String)
    Set objButton = ofcParentBar.Controls.Add(msoControlButton)
    With objButton
        .Caption = strCatNum
        .Style = msoButtonCaption
        .TooltipText = strTipText
    End With
    strThisCat = strTipText
End Sub

Open in new window

0
 
LVL 76

Assisted Solution

by:David Lee
David Lee earned 500 total points
ID: 33600619
This is part #2.  

Follow these instructions to add the code to Outlook.

   1. Start Outlook
   2. Click Tools > Macro > Visual Basic Editor
   3. If not already expanded, expand Microsoft Office Outlook Objects
   4. Right-click on Class Modules, select Insert > Class Module
   5. In the Properties panel click on Name and enter CatBar
   6. Copy the code and paste it into the right-hand pane of Outlook’s VB Editor window
   7. Click the diskette icon on the toolbar to save the changes
   8. Close the VB Editor

Private ofcBar As Office.CommandBar
Private colBtns As Collection

Private Sub Class_Initialize()
    Set colBtns = New Collection
    CreateCATBar Outlook.Application.ActiveExplorer
End Sub

Private Sub Class_Terminate()
    Set colBtns = Nothing
    Set ofcBar = Nothing
End Sub

Private Sub CreateCATBar(olkWindow As Object)
    Dim objCatBtn As CatBtn, _
        intCnt As Integer, _
        objShell As Object, _
        arrTemp As Variant, _
        varChar As Variant, _
        strTemp As String, _
        arrCats As Variant, _
        varCat As Variant
    On Error Resume Next
    Set ofcBar = Outlook.Application.ActiveExplorer.CommandBars("CAT")
    On Error GoTo 0
    If TypeName(ofcBar) = "Nothing" Then
        'Create the toolbar
        Set ofcBar = olkWindow.CommandBars.Add("CAT", msoBarTop, False, True)

        'Create the buttons
        Set ofcButton = ofcBar.Controls.Add(msoControlButton)
        With ofcButton
            .Caption = "CAT"
            .Enabled = False
            .Style = msoButtonCaption
        End With

        'Create the category buttons
        intCnt = 1
        Set objShell = CreateObject("Wscript.Shell")
        arrTemp = objShell.RegRead("HKCU\Software\Microsoft\Office\11.0\Outlook\Categories\MasterList")
        For Each varChar In arrTemp
            If varChar <> "0" Then
                strTemp = strTemp & Chr(varChar)
            End If
        Next
        arrCats = Split(strTemp, ";")
        For Each varCat In arrCats
            Set objCatBtn = New CatBtn
            objCatBtn.Init ofcBar, intCnt, CStr(varCat)
            colBtns.Add objCatBtn
            intCnt = intCnt + 1
        Next
        
        'Make the bar visible onscreen'
        ofcBar.Visible = True
    End If
    Set objCatBtn = Nothing
    Set objShell = Nothing
End Sub

Open in new window

0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 33600640
This is part #3.

Follow these instructions to add the code to Outlook.

   1. Start Outlook
   2. Click Tools > Macro > Visual Basic Editor
   3. If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession
   4. Copy the code and paste it into the right-hand pane of Outlook’s VB Editor window
   5. Click the diskette icon on the toolbar to save the changes
   6. Close the VB Editor
   7. Click Tools > Macro > Security
   8. Set the Security Level to Medium
   9. Close Outlook
  10. Start Outlook. Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run. Say yes.

Dim objCatBar As CatBar

Private Sub Application_Quit()
    Set objCatBar = Nothing
End Sub

Private Sub Application_Startup()
    Set objCatBar = New CatBar
End Sub

Open in new window

0
 
LVL 76

Expert Comment

by:David Lee
ID: 33600670
If all worked correctly, then you should see a new toolbar with numbered buttons.  Mouse over a button and you'll see a tooltip displaying the category name.  Click a button and that category will be added to the currently selected item.  
0
 

Author Closing Comment

by:awesomejohn19
ID: 33617250
Perfect, thanks a lot
0
 
LVL 76

Expert Comment

by:David Lee
ID: 33621687
You're welcome.  Glad I could help.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
exchange 13 42
Excel Web Add-in Where is Visual Basic used 9 77
Outlook Automation in Access Using "Find" 2 57
Using Outlook 2016 with ACT 2012 Pro 2 70
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question