(Fast read!) Send out email automatically with attachment through command button

David77

Board Regular
Joined
Jun 24, 2020
Messages
109
Office Version
  1. 365
Platform
  1. Windows
Hello everybody,

Goal: I am currently trying to create a command button in Excel that, when one clicks on it, sends out an email to me with an order that one has entered into Excel. The following link here: Using Excel VBA to Send Emails with Attachments - wellsr.com has a nice VBA code that goes sends out the email automatically, but does not add the attachment from what I understood when I tried it.

Likewise, this link here has a nice VBA code that adds the attachment, but does not send out the email automatically (under the second title, named: "
Email Selected Worksheets As Outlook Attachment": The VBA Guide To Sending Excel Attachments Through Outlook — The Spreadsheet Guru

Is there an Excel genius here who can help me combine these codes so I can get a command button which, when clicked on, sends out an email automatically to my own email with the Excel sheet attached?

I know this is a lot to ask for, but I would REAAALLY appreciate this! I have been struggling for the past 10+ hours with this and cannot find a solution to this and whenever I try I get "compile error, user-defined type not defined" and more errors in my worksheet.

Thank you so much for your time!

Best regards,
David
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
David I have just replied to your earlier request on the same subject. You don't need to create a new thread.


The code is in my reply and tested and works
 
Upvote 0
David I have just replied to your earlier request on the same subject. You don't need to create a new thread.


The code is in my reply and tested and works

Hello Trevor,

My apologies! Please see my response in the other thread.

Best regards,
David
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,244
Members
452,622
Latest member
Laura_PinksBTHFT

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