Solved

Making Outlook Visible

Posted on 2006-10-27
8
767 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
 
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
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.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
Resolve DNS query failed errors for Exchange
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
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: …

863 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

24 Experts available now in Live!

Get 1:1 Help Now