Re: Way to Specify Profile for Outlook ?

From: Jay B. Harlow [MVP - Outlook] (Jay_Harlow_MVP_at_msn.com)
Date: 02/08/05


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
>



Relevant Pages

  • Re: ConnectComputer Still not working
    ... Use moveuser.exe to migrate the profile. ... Login locally to the XP Pro client computer and create a new local user ... Logoff and logon to the XP Pro client computer using the local account ... specify only user for local ...
    (microsoft.public.windows.server.sbs)
  • Re: ConnectComputer Still not working
    ... > A. Use moveuser.exe to migrate the profile. ... Login locally to the XP Pro client computer and create a new local ... > account that is a member of the local ... Specify domain users in DOMAIN/user ...
    (microsoft.public.windows.server.sbs)
  • Re: how copy local accounts user profile to another with vbscript
    ... >> To copy a user profile ... >> To specify who is permitted to use the copied profile ... > should be able to use the CopyFolder method of the Script Runtime: ...
    (microsoft.public.windows.server.scripting)
  • Re: how copy local accounts user profile to another with vbscript
    ... > Under Profiles stored on this computer, click the user profile you want to ... > To specify who is permitted to use the copied profile ... > add the user, group, or built-in security principle or click Object Types to ... This allows the account domain to change, and/or the user name to change. ...
    (microsoft.public.windows.server.scripting)