Code to send email without attachment

mari_hitz

Board Regular
Joined
Jan 25, 2011
Messages
101
Hi Guys!

I would like to make the following question: I have a command button on a sheet from which after you click on it sends an email including the workbook as an attachment. I would like to know if there is any possibility to send the e-mail without the attachment.

Here is the code that I am using:
Code:
[/FONT]
[FONT=Calibri]Private Sub CommandButton1_Click()[/FONT]
[FONT=Calibri]Dim EmailAddress As String[/FONT]
[FONT=Calibri]'Application.Dialogs(xlDialogSendMail).Show "romina.paola.daniele@hotmail.com", "Opcion 1"[/FONT]
[FONT=Calibri]Application.Dialogs(xlDialogSendMail).Show "romina.paola.daniele@hotmail.com", "Voto Opcion 1"[/FONT]
[FONT=Calibri]End Sub[/FONT]
[FONT=Calibri]
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi,
the below will send an email for you

Code:
Dim OutApp As Object
    Dim OutMail As Object
    Dim strbody As String
      
    Dim user As Variant
   
    user = 'your email addresses
        
    
  
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    strbody = 'body of email
    On Error Resume Next
    With OutMail
        .To = ""
        .CC = ""
        .BCC = user
        .Subject = "Subject goes here"
        .body = strbody
        'You can add a file like this
        '.Attachments.Add ("C:\test.txt")
        .Send   'or use .Display
    End With
    On Error GoTo 0
    Set OutMail = Nothing
    Set OutApp = Nothing
 
Upvote 0

Forum statistics

Threads
1,224,596
Messages
6,179,807
Members
452,944
Latest member
2558216095

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