Results 1 to 1 of 1
2012-06-05, 16:06 #1
- Join Date
- May 2012
- Thanked 0 Times in 0 Posts
Email Workbook using Outlook with two accounts
I am working on a file that creates new workbooks and then uses outlook to send the files. If I have two different outlook accounts (firstname.lastname@example.org and email@example.com) how can I tell the program use firstname.lastname@example.org, or before running the program do I have to open outlook to the right account. Below is the code that i am using to email the workbook... PLEASE HELP!
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
' .To = ActiveSheet.Range("AB3").Value
.To = "email@example.com"
.CC = ""
.BCC = ""
.Subject = "Test"
.Body = "Dear " & ActiveSheet.Range("W3").Value & ", " & "Attached is your report"
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing