How can I designate sender in VBA for Outlook Mail (example code) 
Author Message
 How can I designate sender in VBA for Outlook Mail (example code)

I asked the following question in microsoft.public.excel.misc and it was
suggested that I post it in this group.  I realize the sender is determined
by how you sign in to Outlook but when you are composing mail the option to
set the sender is available manually.  I would like to automate this process
to speed things up and to increase accuracy.  Thanks for your input.

I would like to assign a sender in the "From" field in an Outlook message.
The following code works with the exception of the Sender line.  I am using
Excel 2000, Outlook 2000 and Windows 2000.  I would appreciate any
suggestions.

Thanks

Dim olApp As Outlook.Application
Dim olMI As Outlook.MailItem
'
Set olApp = GetObject("", "Outlook.Application")
Set olMI =
olApp.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items.Add
'
With olMI
.Sender.Add "Doe, Jane"                ' what should this look like
.Recipients.Add Recipients
.BCC = "Doe, John"
.Subject = Subject
.HTMLBody = HTMLBody
.Display
End With



Sun, 29 Aug 2004 23:15:14 GMT  
 How can I designate sender in VBA for Outlook Mail (example code)
To set the From address you will need to use CDO code. See
http://www.cdolive.com/cdo5.htm#ChangeFromAddress and
http://www.cdolive.com/cdo5.htm#MessageOriginator for some code
samples.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


Quote:
> I asked the following question in microsoft.public.excel.misc and it
was
> suggested that I post it in this group.  I realize the sender is
determined
> by how you sign in to Outlook but when you are composing mail the
option to
> set the sender is available manually.  I would like to automate this
process
> to speed things up and to increase accuracy.  Thanks for your input.

> I would like to assign a sender in the "From" field in an Outlook
message.
> The following code works with the exception of the Sender line.  I
am using
> Excel 2000, Outlook 2000 and Windows 2000.  I would appreciate any
> suggestions.

> Thanks

> Dim olApp As Outlook.Application
> Dim olMI As Outlook.MailItem
> '
> Set olApp = GetObject("", "Outlook.Application")
> Set olMI =
> olApp.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items.Add
> '
> With olMI
> .Sender.Add "Doe, Jane"                ' what should this look like
> .Recipients.Add Recipients
> .BCC = "Doe, John"
> .Subject = Subject
> .HTMLBody = HTMLBody
> .Display
> End With



Sun, 29 Aug 2004 23:47:25 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Sending an Outlook mail from my VBA-code doesn't close the mail windows

2. outlook 2000 - VBA - Can i use a Mail Template in my code

3. Outlook macro to filter mails with unknown sender

4. E-mail address of sender in VBA

5. VBA Outlook, sender's email, and Global address book

6. Changing the sender name from Outlook VBA

7. Using VBA to Change the Outlook Sender Account

8. senders email address in outlook VBA

9. VBA coding to call an Excel VBA macro from Outlook

10. Looking for VBA Outlook examples

11. excel vba - help finding designated text within string and deleting selected range's row

12. Automated mail code with example

 

 
Powered by phpBB® Forum Software