Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    Portland, Maine, USA
    Posts
    296
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Display Folder (Outlook XP)

    In some code I am developing, I want to switch to a particular folder. When I used objFolder.display, it opens the folder in a new window. Is there a way so that is will not open a new window?

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Display Folder (Outlook XP)

    I didn't think .Display opened a new window, but try .Activate.
    -John ... I float in liquid gardens
    UTC -7ąDS

  3. #3
    3 Star Lounger
    Join Date
    Feb 2001
    Location
    Portland, Maine, USA
    Posts
    296
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Display Folder (Outlook XP)

    This is the code snippet which switches folders. Activate generates "object does not support this property or method. If I use display instead of activate, a 2nd window opens. That is why I put the IF statement in. Otherwise I kept getting new windows.

    Set objFolder = objName.Folders("Public Folders"). _
    Folders("All Public Folders").Folders(strFolder)
    Set objCurFolder = olApp.ActiveExplorer.CurrentFolder
    If objCurFolder <> "client matters" Then
    objFolder.Activate
    End If

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Display Folder (Outlook XP)

    Try this way:

    Sub ShowSentItems()
    Dim fldNext As Outlook.MAPIFolder
    ' Folder you want to navigate to (this can be anything)
    Set fldNext = Application.GetNamespace("MAPI").GetDefaultFolder( olFolderSentMail)
    ' Navigate the display
    Set Application.ActiveExplorer.CurrentFolder = fldNext
    ' Clean up objects
    Set fldNext = Nothing
    End Sub

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Display Folder (Outlook XP)

    I think Jefferson beat me to it, here's what I had to do to get the active Folder to switch without a new Window:

    Sub SwitchToInbox()
    Dim objNS As Outlook.NameSpace
    Dim collFolders As Outlook.Folders
    Dim objFolder As MAPIFolder

    Set objNS = Application.GetNamespace("MAPI")
    Set collFolders = objNS.Folders
    Set objFolder = collFolders(4).Folders(2) ' set Target Folder for my installation
    ActiveExplorer.SelectFolder objFolder ' redirect the ActiveExplorer to the target Folder
    End Sub

    Obviously, my earlier answer was incorrect, thanks (I think <img src=/S/grin.gif border=0 alt=grin width=15 height=15>) for the learning experience, Darryl.
    -John ... I float in liquid gardens
    UTC -7ąDS

Posting Permissions

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