Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Single Window Application (OL 2003 and <)

    <img src=/S/hello.gif border=0 alt=hello width=25 height=29> Loungers

    When I do something like:

    <font color=blue> Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
    myFolder.Display </font color=blue>


    Where myNameSpace is set to be <font color=blue>CreateObject("Outlook.Application").Get Namespace("MAPI")</font color=blue>

    The Inbox opens in a second window, and not in the original of Outlook?!

    Is this controlled by Windows or the Office 2003 multi-window environment what ever it is called these days, and how do I make it Open in the same window?

    Thanks very much.

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Single Window Application (OL 2003 and <)

    CreateObject will create a new instance of an application, even if it is already running; you can use GetObject to refer to a running instance. Code to test goes like this:

    Dim olApp As Outlook.Application
    Dim myNameSpace As Outlook.NameSpace
    On Error Resume Next
    ' Try to set olApp to running instance of Outlook
    Set olApp = GetObject(, "Outlook.Application")
    If olApp Is Nothing Then
    ' If failed, create new instance
    Set olApp = CreateObject("Outlook.Application")
    If olApp Is Nothing Then
    ' Failed
    MsgBox "Can't open Outlook.", vbCritical
    Exit Sub
    End If
    End If
    Set myNameSpace = olApp.GetNameSpace("MAPI")
    ...

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

    Re: Single Window Application (OL 2003 and <)

    See the thread starting with <post#=375844>post 375844</post#> if you want to activate an existing folder in the existing instance of Outlook.
    -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
  •