| | Awarded by Microsoft since 2005: |  |
| | VBOffice Info | | Visitors | 1390391 | | Impressions | 5093532 |
| |
|
| |
| Author: Michael Bauer | Homepage | | Date: 31.07.2007 | Accessed: 28817 | | | | Description
Do you have an extensive folder structure and must manually open it at every startup of Outlook? Sometimes Outlook does that for you - and frequently it doesn't.
This sample opens all the tree at startup, and it's a spectacle...
There's a variable 'ExpandDefaultStoreOnly' in the procedure 'ExpandAllFolders'. With the current value (True) only the Personal Folder gets expanded. If you want to expand all available mailboxes (archives, Exchange) then set the variable = False. |
Private Sub Application_Startup()
ExpandAllFolders
End Sub
Private Sub ExpandAllFolders()
On Error Resume Next
Dim Ns As Outlook.NameSpace
Dim Folders As Outlook.Folders
Dim CurrF As Outlook.MAPIFolder
Dim F As Outlook.MAPIFolder
Dim ExpandDefaultStoreOnly As Boolean
ExpandDefaultStoreOnly = True
Set Ns = Application.GetNamespace("Mapi")
Set CurrF = Application.ActiveExplorer.CurrentFolder
If ExpandDefaultStoreOnly = True Then
Set F = Ns.GetDefaultFolder(olFolderInbox)
Set F = F.Parent
Set Folders = F.Folders
LoopFolders Folders, True
Else
LoopFolders Ns.Folders, True
End If
DoEvents
Set Application.ActiveExplorer.CurrentFolder = CurrF
End Sub
Private Sub LoopFolders(Folders As Outlook.Folders, _
ByVal bRecursive As Boolean _
)
Dim F As Outlook.MAPIFolder
For Each F In Folders
Set Application.ActiveExplorer.CurrentFolder = F
DoEvents
If bRecursive Then
If F.Folders.Count Then
LoopFolders F.Folders, bRecursive
End If
End If
Next
End Sub
|
| | |
| | |  | ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the ... [more] |
| | |  | Access the master category list in the blink of an eye, share your categories in a network, get a reminder service, and ... [more] |
| | |  | SAM automatically sets the sender, signature, and folder for sent items, for instance based on the recipient ... [more] |
| | |  | OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or ... [more] |
| |
|