VBOffice

Open Selected Items

This is a macro to open all selected items.

Last modified: 2017/01/31 | Accessed: 21.143  | #164
◀ Previous sample Next sample ▶
Category-Manager Category-Manager
With Category-Manager you can group your Outlook categories, share them with other users, filter a folder by category, automatically categorize new emails, and more. You can use the Addin even for IMAP.

The context menu for emails etc. doesn`t have the option to open the selected item. You could open the item by pressing Enter or by a double click on the item; however, some prefer to click on a command button. You can customize the ribbon and add a button to call this macro.


tip  How to add macros to Outlook
'Set any threshold here. Should more items be selected, you'll get a prompt
'asking if you really want to open them all.
Private Const MaxItems As Long = 20

Public Sub OpenSelectedItems()
  Dim Sel As Outlook.Selection
  Dim obj As Object
  Dim i As Long
  
  Set Sel = Application.ActiveExplorer.Selection
  If Sel.Count > MaxItems Then
    If MsgBox("You have " & Sel.Count & _
      " items selected. Do you really want to open them all?", vbYesNoCancel) <> vbYes Then
      Exit Sub
    End If
  End If
  For i = 1 To Sel.Count
    Set obj = Sel(i)
    obj.Display
  Next
End Sub
ReplyAll ReplyAll
ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the e-mail.
email  Send a message