Solved

Outlook Categories Toolbar

Posted on 2010-09-03
15
443 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
  • 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Create high volume marketing opportunities using email signatures with these top 10 DOs and DON'Ts of email signature marketing.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now