PatrickRamon
New Member
- Joined
- Feb 23, 2021
- Messages
- 2
- Office Version
- 365
- Platform
- 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
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