Marco Question: How to set active range as email subject?

vitolau

New Member
Joined
Oct 12, 2017
Messages
2
Hi All,

does any know how to set an active range as email subject?

case like i may select certain cell or range and want it send out as email subject.

ActiveWorkbook.EnvelopeVisible = True

With ActiveSheet.MailEnvelope
.Introduction = ""
.Item.to = ""
.Item.Subject = ""
.Item.Send
End With
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
I am using this, the selected cells are sent in email:

Code:
Sub send_countries()    
    If MsgBox("Do you want to send the selected cells via email?", vbYesNo, "Send cells?") = vbNo Then Exit Sub
    
    Dim OutApp As Object
    Dim OutMail As Object


    Dim SELECTED_cell As Range


    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)


    On Error Resume Next
    With OutMail
        .To = "@gmail.com"
        .CC = "@yahoo.com"
        .BCC = ""
        .Subject = "Subject goes here"
        .Body = "These were the selected cells:" + vbCrLf + vbCrLf
        
        For Each SELECTED_cell In Selection.SpecialCells(xlCellTypeVisible)
            .Body = .Body + SELECTED_cell.Value + vbCrLf
        Next SELECTED_cell
        .Send
    End With
    On Error GoTo 0


    Set OutMail = Nothing
    Set OutApp = Nothing
    
    MsgBox "Email sent"


End Sub
 
Upvote 0

Forum statistics

Threads
1,215,840
Messages
6,127,217
Members
449,370
Latest member
kaiuuu

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