Re: Way to Specify Profile for Outlook ?
From: Jay B. Harlow [MVP - Outlook] (Jay_Harlow_MVP_at_msn.com)
Date: 02/08/05
- Next message: Geraldine Hobley: "Connection pool problems"
- Previous message: Cor Ligthert: "Re: Using Client-Side scripting - MAKING PROGRESS"
- In reply to: Tom Glasser: "Way to Specify Profile for Outlook ?"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 8 Feb 2005 11:33:03 -0600
Tom,
This is a .NET newsgroup, not Access nor VB6.
To answer your question, the Namespace.Logon method allows you to specify
the profile to use:
Something like (untested):
Dim OutApp As Outlook.Application
Dim OutNS As Outlook.NameSpace
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutNS = OutApp.GetNamespace("MAPI")
OutNS.Logon "My Profile"
Set OutMail = OutApp.CreateItem(olMailItem)
NameSpace.Logon has some optional parameters to specify password, UI, & new
Session...
Hope this helps
Jay
"Tom Glasser" <TomGlasser@discussions.microsoft.com> wrote in message
news:414430E3-4948-4209-AC3B-E7E97A4F4A5A@microsoft.com...
>I have the following code in my Access application:
>
> Dim OutApp As Outlook.Application
> Dim OutMail As Outlook.MailItem
>
> Set OutApp = CreateObject("Outlook.Application")
> Set OutMail = OutApp.CreateItem(olMailItem)
>
> Then later in the code, I use 'With OutMail' to send emails.
>
> Is there a way within the VB code to specifiy the Outlook profile to use ?
> (My app needs to run unattended and I can't have Outlook prompting
> for the profile to use.)
>
> Thanks,
> Tom
>
- Next message: Geraldine Hobley: "Connection pool problems"
- Previous message: Cor Ligthert: "Re: Using Client-Side scripting - MAKING PROGRESS"
- In reply to: Tom Glasser: "Way to Specify Profile for Outlook ?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|