Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Expand Outlook 2007 Inbox folders when Opening Outlook

Posted on 2011-03-17
12
Medium Priority
?
609 Views
Last Modified: 2013-02-09
Hello,

we have a user that has many folders in his Inbox. We are using Outlook 2007, Imap. We switched from POP.

Basically, the folders upon restarting outlook, doesn't remain expanded after you reopen Outlook.All of The Inbox folders are collapsed.

Is there a way to have all the Folders in the Inbox expanded via Script/VBA or is there is setting that will allow the Expansion of the Inbox folders to retain through a restart.

0
Comment
Question by:Atomicsteaks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
12 Comments
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 2000 total points
ID: 35163187
I'm not aware you can change the default behaviour but a macro to open all folders is viable as below

expandAll will expand all the default folders, expandInbox will only expand the inbox.

Chris
Sub expandAll()
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim MyFolder As Outlook.MAPIFolder
Dim arrControl As Long
Dim strStoresItem As Variant

    On Error Resume Next
    
    Set olApp = Outlook.Application
    Set objNS = olApp.GetNamespace("MAPI")
    For Each strStoresItem In Application.Session.Stores
        If Not strStoresItem.ExchangeStoreType = olExchangePublicFolder Then
            Set MyFolder = objNS.GetFolderFromID(strStoresItem.StoreID)
            pf_expandAll MyFolder
        End If
    Next

Set objNS = Nothing
Set olApp = Nothing
Set MyFolder = Nothing
 
End Sub
Sub expandInbox()
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim MyFolder As Outlook.MAPIFolder
Dim arrControl As Long
Dim strStoresItem As Variant

    On Error Resume Next
    
    Set olApp = Outlook.Application
    Set objNS = olApp.GetNamespace("MAPI")
    Set MyFolder = objNS.Session.GetDefaultFolder(olFolderInbox)
    pf_expandAll MyFolder

Set objNS = Nothing
Set olApp = Nothing
Set MyFolder = Nothing
 
End Sub

Sub pf_expandAll(startFolder As MAPIFolder)
Dim fldr As Outlook.MAPIFolder
Dim objitem As Object
Dim mai As MailItem
    On Error Resume Next
    
    ' process all the subfolders of this folder
    If startFolder.DefaultItemType <> olMailItem Then Exit Sub
    Set Application.ActiveExplorer.CurrentFolder = startFolder
    DoEvents
    For Each fldr In startFolder.folders
        Call pf_expandAll(fldr)
    Next
 
Set mai = Nothing
Set fldr = Nothing
End Sub

Open in new window

0
 

Author Comment

by:Atomicsteaks
ID: 35168752
Great!!!..Will try It out Over the weekend. Never Added a Marco To Outlook-Will review that First than go from There...
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 35168822
To Create a macro:
------------------

Alt + F11 to open the macro editor

  For User Code:
     Insert | Module to insert a code module into the project
     In the project tree select the module.
     Insert the required macro(s) into the selected module, ('Module1' or similar)

Close the Visual Basic Editor.

To run a macro:
---------------

Alt + F8
Select the macro
Select 'Run'
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

Author Comment

by:Atomicsteaks
ID: 35202196
Issue running the macro's..

“The macros in this project are disabled. Please refer to the online help or documentationof the host application to determine how to enable macros.”

Even though My security is set to the lowest option...Within outlook...
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 35202256
Have you re-opened outlook since enabling macros

Chris
0
 

Author Comment

by:Atomicsteaks
ID: 35749989
Yes,

Program still errors out..
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 35750035
Virus application enabled?

Chris
0
 
LVL 18

Expert Comment

by:Karen Falandays
ID: 38869609
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 38869603
I have posted a solution for the issue and maintained communications including checking why the macros are not running.  There is a therefore a perfectly viable solution here that should be accepted.

35163187

Chris
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 38869610
oops!

I have posted a solution for the issue and maintained communications including checking why the macros are not running.  There is a therefore a perfectly viable solution here that should be accepted.

35163187

Chris
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I discuss my selections of the Top Four free Outlook OST File Viewers available. Open, view and read even damaged OST files by using these tools. They all provide a clear preview of all data such as emails, notes, tasks, calendars, e…
The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

721 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