How to attach with excel file that was automatically deleted the excel sheet during sending an email

anthonymedz

Board Regular
Joined
Jan 30, 2015
Messages
69
Hi guys,

Good day.
Can you help me on this.

When I click the command button the outlook mail will automatically appear with an attachment, however I want the excel sheet on that excel file have been deleted(Sheet 1 or 2).

Code:
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String


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


strbody = "<H3><B>Hi Team,</B></H3>" & _
"Please see the attached shift report for your reference.<br>" & _

On Error Resume Next


With OutMail
.Display
.To = "medz_anthony"
.CC = ""
.BCC = ""
.Subject = "FM-Gaming & Podium Operation Daily Departmental Report_3rd Shift"
.HTMLBody = strbody & "<br>" & .HTMLBody
.Attachments.Add ActiveWorkbook.FullName
'.Send

End With


On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing

Thanks for your advanced help.

Regards,
Anthonymedz
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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