Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Sending e-mails from specific email address

I am preparing code that sends e-mails via Outlook, but gets the data it needs from an Excel spreadsheet. It loops through rows in Excel to get the fields it needs.

The code to send e-mails is below. However, I want the e-mail to be sent from a separate account that I have access to.

Currently, it always sends from (my default).
But I want to send from
(another account I can access via Outlook)

Any help appreciated.

Daniel
____

Sub SendEmails()

Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

mySalutation = "Dear " & Cells(iEmail, 2).Value & ","

On Error Resume Next
With OutMail
.To = Cells(iEmail, 5).Value
.CC = ""
.BCC = ""
.Subject = cells(iMail, 6).value
.Body = mySalutation & Chr(10) & Chr(10) & myBody
.Send
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Sending e-mails from specific email address

Try using

..SendUsingAccount = OutApp.Session.Accounts.Item(1)

Just alter to whatever the A/c number is eg

..SendUsingAccount = OutApp.Session.Accounts.Item(2)
..SendUsingAccount = OutApp.Session.Accounts.Item(3)
etc etc


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Sending e-mails from specific email address

On Tuesday, February 11, 2014 4:21:31 PM UTC-5, wrote:
Try using .SendUsingAccount = OutApp.Session.Accounts.Item(1) Just alter to whatever the A/c number is eg .SendUsingAccount = OutApp.Session.Accounts.Item(2) .SendUsingAccount = OutApp.Session.Accounts.Item(3) etc etc


Thank you very much!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending to email different email address based on cell value Duncan Excel Programming 4 August 25th 09 04:07 PM
Sending Email to non-standard address using CDO? [email protected] Excel Programming 0 February 11th 08 10:40 PM
Sending Email - different reply-to address PWS Excel Programming 4 December 13th 07 07:06 AM
Sending Workbook to an email address. Panagiotis Atmatzidis Excel Discussion (Misc queries) 4 April 21st 07 12:22 AM
Loop through email address list to send e-mails Paul. Excel Discussion (Misc queries) 1 April 12th 05 12:41 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"