Skip to main content

Kutools for Office β€” One Suite. Five Tools. Get More Done.

How to open specific Outlook folder from Excel?

Author Xiaoyang Last modified

Have you ever tried to open a specific Outlook folder from an Excel file, such as opening the "Inbox" folder, "Contacts" folder, or any other folder? In this article, I will talk about how to open a desired Outlook folder from an Excel workbook.

Open specific Outlook folder from Excel file with VBA code


Open specific Outlook folder from Excel file with VBA code

The following VBA code can help you to open a specific Outlook folder from an Excel worksheet, please do these steps:

1. In Excel, hold down the "Alt" + "F11" keys to open the "Microsoft Visual Basic for Applications" window.

2. Click "Insert" > "Module", and paste the following macro in the "Module Window".

VBA code: Open a specific Outlook folder from Excel file:

Sub OpenOutlookFolder()
    Dim xOutlookApp As Outlook.Application
    Dim xNameSpace As Outlook.Namespace
    Dim xFolder As Outlook.Folder
    Dim xFolderType As OlDefaultFolders
    On Error Resume Next
    Set xOutlookApp = New Outlook.Application
    Set xNameSpace = xOutlookApp.Session
    Set xFolder = xNameSpace.GetDefaultFolder(olFolderInbox)
    xFolder.Display
    Set xFolder = Nothing
    Set xNameSpace = Nothing
    Set xOutlookApp = Nothing
    Exit Sub
End Sub

Note: In the above code, you can change the "Inbox" in the "Set xFolder = xNameSpace.GetDefaultFolder(olFolderInbox)" script to any other folder name that you want to open.

3. Then, click "Tools" > "References" in the "Microsoft Visual Basic for Applications" window, and in the popped-out "References-Project1" dialog box, check the "Microsoft Outlook Object Library" option from the "Available References" list box. See screenshot:

check Microsoft Outlook Object Library option in References dialog box

4. Then, click "OK" to close the dialog box, and press "F5" key to run this code, and the specified Outlook folder will be opened immediately.


Best Office Productivity Tools

Breaking News: Kutools for Outlook Launches Free Version!

Experience the all-new Kutools for Outlook with 100+ incredible features! Click to download now!

πŸ€– Kutools AI : Uses advanced AI technology to handle emails effortlessly, including replying, summarizing, optimizing, extending, translating, and composing emails.

πŸ“§ Email Automation: Auto Reply (Available for POP and IMAP)  /  Schedule Send Emails  /  Auto CC/BCC by Rules When Sending Email  /  Auto Forward (Advanced Rules)   /  Auto Add Greeting   /  Automatically Split Multi-Recipient Emails into Individual Messages ...

πŸ“¨ Email Management: Recall Emails  /  Block Scam Emails by Subjects and Others  /  Delete Duplicate Emails  /  Advanced Search  /  Consolidate Folders ...

πŸ“ Attachments ProBatch Save  /  Batch Detach  /  Batch Compress  /  Auto Save   /  Auto Detach  /  Auto Compress ...

🌟 Interface Magic: 😊More Pretty and Cool Emojis   /  Remind you when important emails come  /  Minimize Outlook Instead of Closing ...

πŸ‘ One-click Wonders: Reply All with Attachments  /   Anti-Phishing Emails  /  πŸ•˜Show Sender's Time Zone ...

πŸ‘©πŸΌβ€πŸ€β€πŸ‘©πŸ» Contacts & Calendar: Batch Add Contacts From Selected Emails  /  Split a Contact Group to Individual Groups  /  Remove Birthday Reminders ...

Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Instantly unlock Kutools for Outlook with a single click. Don't wait, download now and boost your efficiency!

kutools for outlook features1 kutools for outlook features2

πŸš€ One-Click Download β€” Get All Office Add-ins

Strongly Recommended: Kutools for Office (5-in-1)

One click to download five installers at once β€” Kutools for Excel, Outlook, Word, PowerPoint and Office Tab Pro. Click to download now!

  • βœ… One-click convenience: Download all five setup packages in a single action.
  • πŸš€ Ready for any Office task: Install the add-ins you need, when you need them.
  • 🧰 Included: Kutools for Excel / Kutools for Outlook / Kutools for Word / Office Tab Pro / Kutools for PowerPoint