Excel Full File, Attached to Outook E Mail

pliskers

Active Member
Joined
Sep 26, 2002
Messages
462
Office Version
  1. 2016
Platform
  1. Windows
I'm having trouble coming up with some code to attach an Excel full file to an Outlook E Mail. The issue is that I'm trying to have the code first save the file with a modified name, using the contents of a cell.

For example: If the file is named "Sales By Customer", I have built a macro to delete all rows in the data other than one selected by a slicer, say customer ABC.

Before attaching to the e-mail, the code should prompt the user to select the folder they want to save the new file to, and once doing that it should save the file with the name of the customer in the name of the new file: "Sales By Customer - ABC.xlsb"

Then I want it to attach the file to an Outook e-mail with the new file name (Sales by Customer - ABC.xlsb) right in the subject field. The other fields will be filled in by the user, so they can be left blank, and nothing needs to be entered in the body of the e mail either.

Can someone provide a sample of code, please? I've come close but am only semi-proficient in VBA and keep getting one error message or the other. Many thanks!
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Can you post the code producing the errors, please? It will likely be easier to use that as a base than to start from scratch.
 
Upvote 0
Can you post the code producing the errors, please? It will likely be easier to use that as a base than to start from scratch.
Thanks for the reply. I got it solved.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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