Solved

Making Outlook Visible

Posted on 2006-10-27
8
766 Views
Last Modified: 2011-10-03
How can I Show/Hide the Outlook object programatically.  In Excel and Word there is a .visible property, but I cannot find a similar property in Outlook.

Mike
0
Comment
Question by:shacho
  • 4
  • 4
8 Comments
 

Author Comment

by:shacho
Comment Utility
Here's what I'm trying to do

'EXCEL VBA ROUTINE
Sub MyRoutine()
    Dim OLApp As Object
    On Error Resume Next
        Set OLApp = GetObject(, "Outlook.Application")
        If Err <> 0 Then Set OLApp = CreateObject("Outlook.Application")
    On Error GoTo 0
    If OLApp Is Nothing Then Exit Sub

'I WANT TO MAKE OUTLOOK VISIBLE HERE

    Set OLApp = Nothing
End Sub
0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
Comment Utility
Greetings, shacho.

The Application object isn't capable of being visible.  It's the Explorer object that becomes visible.  What you need to do is to create an Explorer and then tell it to become visible.  Something like this:

Sub MyRoutine()
    Dim OLApp As Outlook.Application
    On Error Resume Next
        Set OLApp = GetObject(, "Outlook.Application")
        If Err <> 0 Then Set OLApp = CreateObject("Outlook.Application")
    On Error GoTo 0
    If OLApp Is Nothing Then Exit Sub
    OLApp.Explorers.Add OLApp.Session.GetDefaultFolder(6)
    OLApp.Explorers.Item(1).Activate
    Set OLApp = Nothing
End Sub

This code will open the Inbox and make it visible.

Cheers!
0
 

Author Comment

by:shacho
Comment Utility
Cool.  I tried operating on Explorers initially but couldn't get it to work.  It didn't occur to me that you can have zero Explorers.
I'm really trying to get is Outlook.Session.CurrentUser.  This is one of those protected properties that initiates a security dialog with the user.  For some reason that dialog cannot be created unless an explorer is visible.  From an object model or Windows perspective, can you tell me why this is the case?  Is this dialog a child window of an Explorer object?

Mike


0
 
LVL 76

Assisted Solution

by:David Lee
David Lee earned 500 total points
Comment Utility
Hi, Mike.

I've no documentation covering this, but my guess is that the dialog-box requires Outlook's visual interface and it doesn't exist until an Explorer object is created.  I tried to discover if this dialog is a child object by running this code from inside VB6.  Unfortunately, at the point where the dialog-box appears I can't switch back to VB6's debugger to check.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:shacho
Comment Utility
Well anyway, it works now and that's the goal.  Thanks a lot for your help.  I have posted a new, semi-related question.  Please take a look if you can.
http://www.experts-exchange.com/Networking/Q_22041767.html

Cheers,

Mike
0
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
You're welcome.  I followed the link to the other question, but the page says it's been deleted.
0
 

Author Comment

by:shacho
Comment Utility
Yeah - I managed to figure it out before anybody saw it.  Thanks again!

Mike
0
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
No problem.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now