Selecting Multiple Rows in Excel and Create Email with attachment

RYL

New Member
Joined
Nov 13, 2023
Messages
4
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hello, I am looking for help to create an email message by selecting multiple rows in Excel and creating a Table of a few columns.

Data set is in the "Aging" Tab. Sample Table that I would like shown in the "Table" tab. Would like the ability to change/delete columns as needed. Body of email message would like to be able to add some text to message along with a Subject line such as Customer Name - Outstanding Balance.

We have PDF documents that would need to be linked to column E (Invoice Number) and would like to have those PDF's added to email message as an attachment.

Appreciate any help. Thank you.

Example would be to select Rows

Data Set:
1699923733359.png


Email Table:
1699923773868.png
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I found this code here that is almost what I was looking for. Would like the ability to select multiple rows and have the Email Table format created along with the ability to attach PDF documents which are saved as the same Invoice Number.PDF. Appreciate all the help.

VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.CountLarge > 1 Then Exit Sub
If Target.Column <> 3 Then Exit Sub
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = ""
.Subject = Range("A" & Target.Row) & " - " & Range("B" & Target.Row) & " " & Range("C" & Target.Row) & " - " & Range("D" & Target.Row) & " - " & Range("E" & Target.Row)
.HTMLBody = Range("A" & Target.Row) & " - " & Range("B" & Target.Row) & " " & Range("C" & Target.Row) & " - " & Range("D" & Target.Row) & " - " & Range("E" & Target.Row)
.Display
End With
Application.ScreenUpdating = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,262
Messages
6,171,080
Members
452,377
Latest member
bradfordsam

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