Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #9  
Old 07-11-2020, 08:01 PM
gmayor's Avatar
gmayor gmayor is offline Indexing folders Windows 10 Indexing folders Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default



If they are on the same level as Inbox then replace the three macros below in the userform code and it will display all the folders (and subfolders) on the same level as inbox by initial letter:
Code:
Private Sub lstFolders_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim olFldr As Folder
Dim vFolder As Variant
Dim i As Integer
    Set olFldr = Session.GetDefaultFolder(olFolderInbox).Parent
    vFolder = Split(lstFolders.Text, "\")
    For i = 0 To UBound(vFolder)
        Set olFldr = olFldr.folders(vFolder(i))
    Next i
    Hide
    olFldr.Display
lbl_Exit:
    Set olFldr = Nothing
    Unload Me
    Exit Sub
End Sub


Private Sub CommandOK_Click()
Dim olFldr As Folder
Dim vFolder As Variant
Dim i As Integer
    If lstFolders.ListIndex > -1 Then
        Set olFldr = Session.GetDefaultFolder(olFolderInbox).Parent
        vFolder = Split(lstFolders.Text, "\")
        For i = 0 To UBound(vFolder)
            Set olFldr = olFldr.folders(vFolder(i))
        Next i
        Hide
        olFldr.Display
    Else
        Beep
        MsgBox "Nothing selected"
    End If
lbl_Exit:
    Set olFldr = Nothing
    Unload Me
    Exit Sub
End Sub

Private Sub ResetList(X As String)
Dim cFolders As Collection
Dim olfolder As Outlook.Folder
Dim SubFolder As Outlook.Folder
Dim olNS As Outlook.NameSpace
Dim strPath As String
Dim sSubPath As String
Dim sStore As String
    lstFolders.Clear
    Set cFolders = New Collection
    Set olNS = GetNamespace("MAPI")
    cFolders.Add olNS.GetDefaultFolder(olFolderInbox).Parent
    Do While cFolders.Count > 0
        Set olfolder = cFolders(1)
        cFolders.Remove 1
        sStore = olfolder.Store
        sSubPath = Replace(olfolder.FolderPath, "\\" & sStore & "\", strPath)

        ProcessFolder olfolder, sSubPath, X
        If olfolder.folders.Count > 0 Then
            For Each SubFolder In olfolder.folders
                cFolders.Add SubFolder
            Next SubFolder
        End If
    Loop
lbl_Exit:
    Set olfolder = Nothing
    Set SubFolder = Nothing
    Set cFolders = Nothing
    Exit Sub
 End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Indexing folders Indexing Holger Rudbeck Word 2 05-02-2020 03:13 PM
Indexing folders Indexing whole document Matt Rance Word 8 11-06-2012 06:05 AM
Indexing folders Auto Indexing won052 Word 1 07-27-2012 11:43 AM
Indexing folders Indexing - Subentries godofpool Word 1 07-09-2012 11:28 AM
Indexing folders Auto indexing tomsan Word 1 03-05-2012 03:54 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:32 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft