In Outlook on Windows I have a VBA script that moves one or more messages from Inbox to a folder, attached to a keyboard shortcut that I use to very quickly move hundreds of emails to where I want them every day.

Is there any feature like that in Outlook on Mac? I'm not sure how to phrase the question, I don't want to be too narrow by asking "Is there VBA and Macros in Outlook on Mac" when obviously there is not, but is there some other way to approach this problem, automating things and assigning keyboard shortcuts to personalized tasks?

Edit: One comment mentioned Applescript. (I'm a newbie to Mac). I then found this article on enabling the Applescript icon and this article on using Applescript to create a Task from a Message. That's not exactly what I want but it's a HUGE step forward. I will now study Applescript and Outlook's use of it and if I get anywhere, will answer my own question.

  • I know that Outlook supports Applescript but I gather it is fairly limited in its utilities. It also supports VBA it seems: datanumen.com/blogs/run-vba-code-outlook – Steve Chambers Sep 4 '18 at 19:57
  • The datanumen article is about Windows. I'll look at Applescript, thank you for suggesting it. – jay613 Sep 4 '18 at 20:37
  • Firstly, welcome to Ask Different! :) I hope you come to find this site to be a valuable resource. Unfortunately, both Outlook and OneNote do not support VBA on the Mac (although Excel, PowerPoint and Word do). Since you're really just wanting to move messages from your inbox to a folder, is there a reason why setting up a rule (or rules) will not meet your needs? I ask because it may help clarify your question further. – Monomeeth Sep 5 '18 at 6:39
  • @Monomeeth the objective is to move hundreds of emails (daily) to folders using keyboard shortcuts, because it is much much faster, easier, and less error-prone to do it that way than by dragging them with the mouse. I do have rules that do this too, but this requirement is for those emails that are not dealt with by rules. It's a human task, and the scripts and keyboard shortcuts make it an order of magnitude easier. – jay613 Sep 5 '18 at 14:06

Here is a way in Outlook 2016 on Mac to do the equivalent of Windows "Write a VB script and assign it to a key". Thanks to those who pointed me in the right direction. On Mac this is done with Applescript, Automator, and Keyboard Shortcuts. I'm including the Applescript here that moves selected Outlook emails to an archive folder. Also shown below for reference is the original VBA I was trying to emulate on Mac.

Step 1 – Write Applescript to move selected Outlook item to Archive

  • Press Command-Tab to launch Spotlight Search, type “Script Editor” to launch it.
  • Optional: Install a shortcut to the script editor in the Apple menu as follows. You have to be in the script editor first, then in the menu at the top choose Script Editor->Preferences. Then in preferences choose General, and check (enable) “Show Script menu in menu bar” and also “Show Computer scripts”.
  • Start with the following script. Run it, test it, play with it. Look elsewhere for help on changing this to do exactly what you want. This script moves the currently selected email(s) to a folder named “IZ – Archive”. Change the folder name to suit yourself. There’s lots of room for improvement here. I’d like to solve the Reminders problem.

    tell application "Microsoft Outlook"
        -- get the currently selected message or messages
        -- NOTE in this version it fails if the Outlook Reminder window is open, even if you select a message in the main window.
        set selectedMessages to current messages
        -- if there are no messages selected, warn the user and then quit
        if selectedMessages is {} then
            display dialog "Please select a message first and then run this script." with icon 1
        end if
        set aMessage to item 1 of selectedMessages
        set emailAcct to account of aMessage
        set inBoxFolder to folder "Inbox" of emailAcct
        set ArchiveFolder to folder "IZ - Archive" of inbox
        repeat with theMessage in selectedMessages
            move theMessage to IZArchiveFolder
        end repeat
    end tell

Step 2 – Assign the Applescript to a Service using Automator

  • Press Command-Tab to launch Spotlight Search, from there launch Automator
  • In Automator, choose a type for your document, choose “Service”. You will create a service from your script.
  • At the top of the service, set the two settings to: Service receives no input in any application From the left panel, choose Library, then in the second panel from the long list find “Run Applescript”, and drag that into the main service window.
  • Copy and paste your Applescript replacing (* Your script goes here *)

  • Save the service, giving it a name like MoveSelectedOutlookMailToArchive. It’s not obvious how to “Save As” in Automator. Play around with the “File” menu at the top of the screen and do some googling.

  • The service will be saved under ~/Library/Services/yourservicename

Step 3 – Assign the Service to a Key

  • Go to Keyboard Shortcuts either from Outlook Menu->Outlook->Services->Services Preferences or from System Preferences->Keyboard->Shortcuts->Services
  • In the Keyboard Shortcuts editor choose “Services” on the left, then go to the bottom under the “General” section where you will find your new service.
  • Click on that, and assign the keyboard shortcut you would like.


For reference and comparison here is the original VBA script I was trying to emulate on Mac. As you can see, the Applescript is more concise and intuitive, on the other hand the mechanism to assign it to a key (not shown here) is WAY easier on PC.

'Outlook VB Macro to move selected mail item(s) to a target folder
Sub MoveToIZArchive()
On Error Resume Next

Dim ns As Outlook.NameSpace
Dim moveToFolder As Outlook.MAPIFolder
Dim objItem As Outlook.MailItem

Set ns = Application.GetNamespace("MAPI")

'Define path to the target folder
Set moveToFolder = ns.GetDefaultFolder(olFolderInbox).Folders("IZ - Archive")

If Application.ActiveExplorer.Selection.Count = 0 Then
   MsgBox ("No item selected")
   Exit Sub
End If

If moveToFolder Is Nothing Then
   MsgBox "Target folder not found!", vbOKOnly + vbExclamation, "Move Macro Error"
End If

For Each objItem In Application.ActiveExplorer.Selection
   If moveToFolder.DefaultItemType = olMailItem Then
      If objItem.Class = olMail Then
         'objItem.UnRead = False
         objItem.Move moveToFolder
      End If
  End If

Set objItem = Nothing
Set moveToFolder = Nothing
Set ns = Nothing

End Sub
  • 1
    You said, "The service will be saved under /Library/Services/", which is not the correct location, they are saved in /Users/$USER/Library/Services/ or for short: ~/Library/Services/ – user3439894 Sep 18 '18 at 16:44
  • Note that for the specific task I use in the above example, moving selected emails to an archive, Outlook 2016 for Mac now has built-in functionality that is an Archive folder and an Archive button. Those are good enough for that task. The procedure above however is applicable to any customized task, you just have to find the appropriate applescript to do what you want. – jay613 Jul 28 '20 at 13:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .