pliskers
Active Member
- Joined
- Sep 26, 2002
- Messages
- 462
- Office Version
- 2016
- Platform
- 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!
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!