Solved

Send Username, password and domain from ms access towards ms outlook

Posted on 2007-03-28
3
272 Views
Last Modified: 2008-02-01
Dear Experts,

I created a button on a form which should be able to check if Outlook is open. If not, the function should send the logon information towards Outlook and open it. Below the code I already found on EE which basicly checks if Oulook is open or not.
First the code which calls the function IsOutLookOpen. It sends the logon and password to the function:

    Dim stlogon As String
    stlogon = Me.OutlookDomain & "\" & Me.OutlookUser
    Dim stpassword As String
    stpassword = Me.OutlookPass
    IsOutlookOpen stlogon, stpassword

Then the function :

Function IsOutlookOpen(stlogon As String, stpass As String) As Boolean
    Dim olApp As Outlook.Application
    Set olApp = CreateObject("Outlook.Application")
    Dim olNs As Outlook.NameSpace
    Set olNs = olApp.GetNamespace("MAPI")
   
    Dim objOL As Object
    On Error Resume Next
    Set objOL = GetObject(, "Outlook.Application")
    If Err.Number = 429 Then
        Set objOL = CreateObject("Outlook.Application")
        If Err.Number = 0 Then
            objOL.Visible = False
            IsOutlookOpen = True
            MsgBox "Outlook has been opened"
        Else
            MsgBox "Outlook failed to open"
            IsOutlookOpen = False
        End If
    Else
        IsOutlookOpen = True
    End If
End Function

Now I need to find out how I can use the parameters send in the function call (stlogon, stpass) to open ms Outlook without any further intervention from the user.

Any ideas?

Thanks a lot in advance!
0
Comment
Question by:jrameuwissen
  • 2
3 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 18809353
I found this snippet of code:

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
objNamespace.Logon "Default Outlook Profile",, False, True    

Where the 3rd and 4th arguments are:

3rd argument: Show Dialog
4th Argument: New Session

The second argument is for a password, but according to this article is for backwards compatibility and is almost never used.

That said, I'm not sure the security model of Outlook will allow you to pass in this information. Much has changed since the onslaught of spam and malware, and Outlook has often "beefed up" security by simply disallowing automated procedures (like, perhaps, automated logins).
0
 
LVL 1

Author Comment

by:jrameuwissen
ID: 18814125
LSMConsulting,

Thanks. I tried using your code but for some reason I still receive a popup which requires a password.
Isn't there a setting in Ms Outlook that I can use, so that I do not have to enter a password anymore?

Thanks again.
0
 
LVL 1

Author Comment

by:jrameuwissen
ID: 19063998
Issue solved. Thanks.
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

832 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