How to use VBS to set categories for items in Outlook

For those who miss Outlook classes, this is run this VBScript process to get them again.

email.jpg

Picture: istock/anyaberkut

Many Outlook customers depended closely on the class function till it was eliminated. So, it was no large shock after I began listening to from readers and purchasers in regards to the loss. Luckily, you possibly can reclaim the function. If you wish to accomplish that manually, learn Reclaim Outlook classes for IMAP accounts. This method works with any open Outlook merchandise, not simply e mail messages. You are able to do the identical factor with a VBScript process, which I discover far more environment friendly than utilizing the guide route. On this article, I will overview a easy process that automates reclaiming classes. I do need to stress that as a result of this function is now not supported, the process might cease working at any time and with out discover.

SEE: 83 Excel ideas each consumer ought to grasp (TechRepublic)

I am utilizing Microsoft 365 on a Home windows 10 system; this process is not acceptable within the on-line Mail app. To your comfort, you possibly can obtain the .cls code module.

The VBScript process in Outlook

For those who’re conversant in VBA however not VBScript, don’t be concerned. VBS is a subset of VBA. Even if you happen to’re not conversant in VBA, you should have no bother including and working this process. The sub process in Itemizing A is very simple. The one catch is that the Outlook merchandise you’re categorizing have to be open.

Itemizing A

Public Sub SetCategory()

    ‘Shows class dialog so consumer can

    ‘set class to open merchandise.

    ‘If class is unused, function will immediate

    ‘for shortcut key choice.

    Dim OLItem As Object

    ‘Quits process if no merchandise is open.

    On Error GoTo ErrorHandler

    Set OLItem = Utility.ActiveInspector.CurrentItem

    OLItem.ShowCategoriesDialog

    Exit Sub

ErrorHandler:

    MsgBox “Please open the merchandise you need to categorize.”, vbOKOnly, “Error”

    Exit Sub

Finish Sub

First, the code creates an Object variable named OLItem and units it to the energetic (open) merchandise. You need to use this process to categorize any Outlook object—however it have to be open for the process to work. The ultimate line shows the Classes dialog, so you possibly can set a class for the present merchandise, OLItem. That is all of the process does, however you will proceed by checking a class (coloration). If that class hasn’t been used earlier than, the function (not the code) will immediate you to set a keystroke shortcut. You are able to do so or cancel that immediate.

There’s a little bit of error-handling for these instances when no merchandise is open. The code will show a warning message field after which stop the process.

SEE: Home windows 11: Recommendations on set up, safety and extra (free PDF) (TechRepublic)

To enter the process, press Alt + F11 to open the Visible Fundamental Editor. Within the Undertaking Explorer to the left, choose ThisOutlookSession so you possibly can run the process in any window. You may enter the code manually or import the downloadable .cls file. For those who enter the code manually, do not paste from this internet web page. As a substitute, copy the code right into a textual content editor after which paste that code into the ThisOutlookSession module. Doing so will take away any phantom internet characters that may in any other case trigger errors.

The way to use the process in Outlook

Earlier than working the process, examine the safety setting by clicking the File tab after which selecting Choices. On the backside of the left pane, click on Belief Middle after which click on Belief Middle Settings within the dialog. Within the left pane, click on Macro Settings. You will have 4 choices. Click on one of many three choices that can help you execute macros, as proven in Determine A. Your stage or safety is dependent upon you and your group; I selected Notification for All Macros. Click on OK twice. If you need to change this feature, shut and restart Outlook earlier than you proceed.

Determine A

outlookvbssetcategory-a1.jpg

  Select a safety choice that enables VBScript procedures.

Now, let’s execute the process as follows:

  1. Open an current e mail.
  2. Click on the Developer tab (if you happen to do not see the Developer tab, see “The way to add the Developer tab” under).
  3. Within the Macros group, click on Macros.
  4. From the dropdown, click on SetCategory (Determine B) and click on Run.
  5. Within the ensuing dialog, select a class coloration, equivalent to blue. If blue hasn’t been chosen earlier than, the function (not the code) opens a second dialog that lets you title the class and set a shortcut. In any other case, click on the Shortcut Key dropdown and select the shortcut Ctrl + F2 (Determine C).
  6. The function applies the blue class (Determine D).

Determine B

outlookvbssetcategory-b-2.jpg

  Execute the process SetCategory.

Determine C

outlookvbssetcategory-c.jpg

  Select a class (by coloration) after which set a keyboard shortcut.

Determine D

outlookvbssetcategory-d.jpg

  The blue strip under the header info is the visible affirmation that you’ve got categorized this e mail.

You may shut the e-mail while you like; it is categorized as blue. To take away the class, open the merchandise, right-click the class coloration line and select Clear Class.

Add the Developer tab

For those who do not see the Developer tab, you possibly can rapidly show it as follows:

  1. Click on the Fast Entry Toolbar dropdown and select Extra Instructions.
  2. Click on Customise Ribbon within the left pane.
  3. Within the record to the proper, examine Developer, as proven in Determine E.
  4. Click on OK.

Determine E

outlookvbssetcategory-e.jpg

  Add the Developer tab to the ribbon.

It is unlikely that you will need to work by all these steps each time you need to run the process. As a substitute, add the macro to the Fast Entry Toolbar. To take action, learn The way to add Workplace macros to the QAT toolbar for fast entry.

Additionally see

Recent Articles

spot_img

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here

Stay on op - Ge the daily news in your inbox