Add "From" value in outlook VBA Excel

PatrickRamon

New Member
Joined
Feb 23, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm adding a macro to send an email from Excel, however, I'm getting an error while I try to add .From = "email account", I have 2 different accounts set up in outlook. I'm able to run the macro whit out the field "send from".

Private Sub Email_Click()
Range("A2:G65").Copy
'Selection.Copy

esubject = Range("M1")
sendfrom = " email account"
sendto = "Amy"
ccto = ""
ebody = ""

Set app = CreateObject("Outlook.Application")
Set itm = app.createitem(0)

With itm
.Subject = subject
.From = sendfrom - this is the line I'm getting debug error when i run the macro -
.To = sendto
.cc = ccto
.body = ebody
.display


End With
Set app = Nothing
Set itm = Nothing
End Sub
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Forum statistics

Threads
1,223,885
Messages
6,175,183
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top