Solved

Making Outlook Visible

Posted on 2006-10-27
8
770 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

If you don't know how to downgrade, my instructions below should be helpful.
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.
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

726 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