Solved

Making Outlook Visible

Posted on 2006-10-27
8
771 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 

Author Comment

by:shacho
ID: 17824663
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
ID: 17825753
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
ID: 17827385
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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 76

Assisted Solution

by:David Lee
David Lee earned 500 total points
ID: 17827495
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
 

Author Comment

by:shacho
ID: 17830712
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
ID: 17830950
You're welcome.  I followed the link to the other question, but the page says it's been deleted.
0
 

Author Comment

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

Mike
0
 
LVL 76

Expert Comment

by:David Lee
ID: 17832882
No problem.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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 …

734 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