Consulting

Results 1 to 4 of 4

Thread: Jump to userdefined folder in Outlook 2019

  1. #1
    VBAX Regular
    Joined
    May 2018
    Posts
    50
    Location

    Question Jump to userdefined folder in Outlook 2019

    Hi

    by clicking the macro the Ol folder should be opened.
    I can do this and jump to Inbox

    Sub ChangeViewtoFolderPosteingang()
    
        Dim ns As Outlook.NameSpace
        Set ns = Application.GetNamespace("MAPI")
    
    
        Dim Exp As Outlook.Explorer
        Set Exp = Application.ActiveExplorer
    
    
        Dim myInbox As Folder
        Set myInbox = ns.GetDefaultFolder(olFolderInbox)
    
    
        Dim folder1 As Folder
        Set folder1 = myInbox
    
    
        Set Exp.CurrentFolder = folder1
    
    
    End Sub
    WORX!

    And jump to subfolder of Inbox:
    Sub ChangeViewtoFolderFAX()
    
        Dim ns As Outlook.NameSpace
        Set ns = Application.GetNamespace("MAPI")
    
    
        Dim Exp As Outlook.Explorer
        Set Exp = Application.ActiveExplorer
    
    
        Dim myInbox As Folder
        Set myInbox = ns.GetDefaultFolder(olFolderInbox)
    
    
        Dim folder1 As Folder
        Set folder1 = myInbox.Folders.Item("FAX")
    
    
        Set Exp.CurrentFolder = folder1
    
    
    End Sub
    WORX too!

    But How to jump to user defined Folder # Datenbank?

    The folder # Datenbank is in the main Tree!

    Hope for help

  2. #2
    You have to complete the path to the folder. If it is on the same level as Inbox then

    Sub ChangeViewtoFolderDatenbank()
        Dim ns As Outlook.NameSpace
        Dim Exp As Outlook.Explorer
        Dim folder1 As Folder
        
        Set ns = Application.GetNamespace("MAPI")
        Set Exp = Application.ActiveExplorer
    
    
        Set folder1 = ns.GetDefaultFolder(olFolderInbox).Parent.folders.Item("Datenbank")
        Set Exp.CurrentFolder = folder1
    End Sub
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

  3. #3
    VBAX Regular
    Joined
    May 2018
    Posts
    50
    Location
    THX

    But How to jump to user defined Folder # Datenbank?


    The folder # Datenbank is in the main Tree!
    and its Uerdefined - containing Contact Items (not Standard Folder)


    Bild2.jpg

    That's my problem

    somwhere here?:
    ns.GetDefaultFolder(olFolderInbox)
    Last edited by Witzker; 12-04-2020 at 12:34 PM.

  4. #4
    Change
    Set folder1 = ns.GetDefaultFolder(olFolderInbox).Parent.folders.Item("Datenbank")
    to
    Set folder1 = ns.GetDefaultFolder(olFolderInbox).Parent.folders.Item("# Datenbank")
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •