Excel Forumn Example.xlsmI'm currently working on a macro that will allow you to highlight columns and generate an email with only the information that was highlighted. Currently, I have it set up where all of my information is in a table which allows me to filter information if I need to, but I'm running into an issue when I attempt to send filtered information. For example, lets say I have rows 1-5. I filter my information and only rows 1,3, and 5 are shown when I highlight these rows and attempt to send them my code will still send all of the rows 1-5. Is there anyway to fix this? I have attached a blank copy of my excel spreadsheet with the macros attached. Any help would be greatly appreciated. MY code is also below.
Sub Send_Selection_Or_ActiveSheet_with_MailEnvelope()
'Working in Excel 2002-2013
Dim Sendrng As Range
On Error GoTo StopMacro
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
'Note: if the selection is one cell it will send the whole worksheet
Set Sendrng = Selection
'Create the mail and send it
With Sendrng
ActiveWorkbook.EnvelopeVisible = True
With .Parent.MailEnvelope
' Set the optional introduction field thats adds
' some header text to the email body.
.Introduction = "Good Morning,"
With .Item
.TO = ""
.CC = "Jared.j@fakeemail.com"
.BCC = ""
.Subject = "forumn example"
.display
End With
End With
End With
StopMacro:
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
ActiveWorkbook.EnvelopeVisible = True
End Sub
Any Help Would be greatly Appreciated.
Bookmarks