Solved

Making Outlook Visible

Posted on 2006-10-27
8
768 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
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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
In this step by step procedure, you will come to know the details of creating an Outlook meeting in 2007, 2010, 2013 & 2016.
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

785 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