A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Changing CurrentUser Programmatically



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 14th 08, 12:34 AM posted to microsoft.public.outlook.program_vba
Alan Cuthbertson
external usenet poster
 
Posts: 1
Default Changing CurrentUser Programmatically

Hi,

I have a VB6 program that is sending emails using the Outlook Object Library
in Outlook 2003. It is all working fine except it always uses the Default
User account to send the email.

I can go in to outlook and change the default user then send the email, but
I would rather automate this part.

I am able to create the Outlook session and view the current user via the
mOutlookApp.Session.CurrentUser, but it is only read only. Is there a way to
change it?


Ads
  #2  
Old July 14th 08, 12:43 AM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Changing CurrentUser Programmatically

No, it's read-only. It wouldn't do any good even if you could, because it has
no bearing on how messages are sent.

Can you provide more details? Are you trying to send from another Exchange
mailbox? With through a different POP3/SMTP or IMAP4/SMTP account? Is Word
the email editor?
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx



"Alan Cuthbertson" wrote:

Hi,

I have a VB6 program that is sending emails using the Outlook Object Library
in Outlook 2003. It is all working fine except it always uses the Default
User account to send the email.

I can go in to outlook and change the default user then send the email, but
I would rather automate this part.

I am able to create the Outlook session and view the current user via the
mOutlookApp.Session.CurrentUser, but it is only read only. Is there a way to
change it?


  #3  
Old July 14th 08, 01:46 AM posted to microsoft.public.outlook.program_vba
Alan Cuthbertson[_2_]
external usenet poster
 
Posts: 1
Default Changing CurrentUser Programmatically


Hi Sue,

I am using Outlook 2003, and they are Pop/SMTP accounts and I am using Word
as the email editor.

The bit of VB6 code I use is :-

Dim mOutlookApp As Outlook.Application
Dim mNameSpace As Outlook.NameSpace
Dim mItem As MailItem

Set mOutlookApp = CreateObject("Outlook.application")
Set mNameSpace = mOutlookApp.GetNamespace("MAPI")

MsgBox mOutlookApp.Session.CurrentUser

Set mItem = mOutlookApp.CreateItem(olMailItem)
mItem.Recipients.add "aaa@bbbb"
mItem.Subject = "test"
mItem.BodyFormat = olFormatHTML
mItem.HTMLBody = "Message"
mItem.Save
mItem.Send



"Sue Mosher [MVP-Outlook]" wrote:

No, it's read-only. It wouldn't do any good even if you could, because it has
no bearing on how messages are sent.

Can you provide more details? Are you trying to send from another Exchange
mailbox? With through a different POP3/SMTP or IMAP4/SMTP account? Is Word
the email editor?
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx



"Alan Cuthbertson" wrote:

Hi,

I have a VB6 program that is sending emails using the Outlook Object Library
in Outlook 2003. It is all working fine except it always uses the Default
User account to send the email.

I can go in to outlook and change the default user then send the email, but
I would rather automate this part.

I am able to create the Outlook session and view the current user via the
mOutlookApp.Session.CurrentUser, but it is only read only. Is there a way to
change it?


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Query CurrentUser from Outlook View [email protected] Outlook and VBA 3 March 27th 08 10:07 PM
namespace.CurrentUser - exactly where does this come from KateG Outlook and VBA 3 February 20th 08 08:26 PM
Programmatically changing the message's sender field in MAPI. JahMic Add-ins for Outlook 2 August 15th 07 02:15 PM
Programmatically changing settings in Outlook 2003 Jonathan Add-ins for Outlook 1 April 7th 06 08:49 PM
capturing the currentuser... Martin Outlook and VBA 7 January 17th 06 11:56 AM


All times are GMT +1. The time now is 08:08 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.