Results 1 to 1 of 1
2012-06-05, 17: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 (email@example.com and firstname.lastname@example.org) how can I tell the program use email@example.com, 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 = "firstname.lastname@example.org"
.CC = ""
.BCC = ""
.Subject = "Test"
.Body = "Dear " & ActiveSheet.Range("W3").Value & ", " & "Attached is your report"
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing