Macro to send automated email at a particular time of a day

ayushkumar

New Member
Joined
Jul 12, 2013
Messages
3
Hello Team,</SPAN>

I am a new user to this site and to the VBA too. I joined recently to this site in July. I need your quick help on one of the projects I am working upon but I am stuck at a point where your expertise would matter.</SPAN>

I am currently an Assistant Manager at an organization where we use Excel documents at a full fledge. All reporting and statistics are presented using Excel.</SPAN>

I have a file 1 which is a master file and have around 25 columns of data. There is another file 2 which has 5 columns and gets input from the file 1 based on vlookup formula. I update the file 1 on regular intervals in a day and hence the file 2 gets updated through the vlookup formula. Now all I want is that every day, at two intervals say the mid of the day and end of the day, an automated trigger email should be sent to a recipient which will have the file 2 attached in that email. The macro should do this automatically at the particular time mentioned for a day. </SPAN>

I have written the following code and need your help in editing it to make it automated to be sent at a particular time of a day:</SPAN>

----------------</SPAN>

Sub example()</SPAN>
Dim OutApp As Object</SPAN>
Dim OutMail As Object</SPAN>

Set OutApp = CreateObject("Outlook.Application")</SPAN>
Set OutMail = OutApp.CreateItem(0)</SPAN>

On Error Resume Next</SPAN>
With OutMail</SPAN>
.to = "zzzzzz@xxx.com"</SPAN>
.CC = "yyyyyyyy@xxx.com"</SPAN>
.BCC = ""</SPAN>
.Subject = "STATUS REPORT"</SPAN>
.Body = "Hello Ayush, Here is the update on the reports"</SPAN>
.Attachments.Add ("file_path")</SPAN>
.Display</SPAN>
End With`</SPAN>
On Error GoTo 0</SPAN>

Set OutMail = Nothing</SPAN>
Set OutApp = Nothing</SPAN>
End Sub</SPAN>


-----</SPAN>

Many thanks for looking into this abrupt request.</SPAN>

Regards,</SPAN>
Ayush</SPAN>
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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