Solved

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

Posted on 2007-03-28
3
249 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

760 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

19 Experts available now in Live!

Get 1:1 Help Now