Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

monthly reminded vba

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Monthly Reminded by VBA

Monthly Reminded by VBA

ResolvedVersion 2010

Andrew has attended:
Excel VBA Advanced course

Monthly Reminded by VBA

Hi Jens, I would like to send out timely reports based on some data either in excel or access. Could I use the excel Time function stored in the Personal Workbook and have windows open it automatically each day. On a given day of a month the VBA will email some data?

Many thanks!
Andrew

RE: Monthly Reminded by VBA

Hi Andrew,

Thank you for the forum question.

If you copy the code below to your personal macro work - ThisWorkbook module it should do what you want.

Please have a look at my comments. You will need to add the reminder dates in the array function in the order first month then day and then year. You can add as many date you want separated by commas and the dates must be inside #. You need of course also to amend the email details and the path to the workbook you want to send.

Private Sub Workbook_Open()
Dim ReminderDates


'type the dates in the in the array. You have to do it the "American" way. First month then day.
ReminderDates = Array(#8/1/2014#, #12/31/2014#, #7/31/2014#)

For Each i In ReminderDates
If i = Date Then Call SendWorkBook
Next

End Sub

Sub SendWorkBook()

Dim OutApp As Object

Dim OutMail As Object

'change to the right path
Workbooks.Open ("C:\Users\jens\Documents\Excel Advanced VBA\Send Email\email.xlsm")

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = "xxxx@xxxx.com" 'change the email
.CC = ""
.BCC = ""
.Subject = " Monthly report for month " & Format(Date, "mmmm") 'change the subject
.Body = "Hello World!" & vbCrLf & "New line text" 'change the body text
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing

ActiveWorkbook.Close

End Sub


I Hope this will do the job. Please let me know if you get any problems.


Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

Fri 8 Aug 2014: Automatically marked as resolved.

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Sum Up All the Values in A Column

If you want to quickly calculate the Summed values of all cells in a column in Excel 2003 normally you would use the SUM formula. (eg if you wanted to calculate the values in Column C rows 10 to 25) the formula would be:

=SUM(C10:C25)

However, if you keep adding values to column C you would keep having to modify the above SUM formula which can get quite annoying.

To get around this you can sum all the values in a column using the following formula:

=SUM(COLUMN:COLUMN)

Which, in our example, would be:

=SUM(C:C)

NOTE You cannot place this formula in column C, or else Excel 2003 will show a circular reference error.

The formula must be placed in any other column, EXCEPT the one being calculated.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.