# Office 365 >  >  Macro, Auto, Email, Date

## MARILYNMING

Using Excel Office 365.  This is the Module.  I'm sure it is something very simple but it is driving me crazy.  It sends the email perfectly when I hit "run" from Developer, Macros.  I need it to run when the Workbook opens.  This code is in a module for "Sheet 16".  The dates are in the two columns.  Thanks for your help.




```
Please Login or Register  to view this content.
```

----------


## gmr4evr1

Removed, OP complied with request

----------


## MARILYNMING

I tried to do what you asked but I cannot figure out how to post it and it took out my edit.

----------


## gmr4evr1

Looks like you got it.
Give the following code a try, it goes in the ThisWorkbook module



```
Please Login or Register  to view this content.
```

----------


## MARILYNMING

I don't understand.  That opens a new workbook.  I have inserted tomorrows date to see what happens.  I have my Excel, (the shortcut to the workbook that I'm working in) open on boot up every day.  It is the only program (app) that I have start.  I will have to wait until tomorrow to see if it works smoothly.  I will reply to you when I see what happens.  Thank you

----------


## gmr4evr1

Opens a new workbook? All I did was place the code you provided in the ThisWorkbook module and changed the name to Private Sub Workbook_Open()
What this does it that anytime the workbook is opened, the code will run. Is that not what you wanted?

----------


## MARILYNMING

I think I know what might have happened.  With all the struggle, I think the Macros got stuck.  I have opened a new, clean Excel and have copied the worksheets, (not moved) so that there are no Macros.  Now I have to finish setting them up and then will try the Macro.  I'm going to assume that the one Macro will work on all the worksheets as long as my dates are in those specific columns and I can ad columns as I need to.  Would love your input if you have time.

----------


## gmr4evr1

When you put my code in the workbook module, did you delete the previous code?

----------


## MARILYNMING

UPDATE:  I did not receive notice that you had replied.  I think what happened was: Office ran an update, JAVA ran an update, OUTLOOK did not run the emails I sent to my second account, etc.  Messed up the computer BIG time.  A comedy of errors.  What I have done is created a new workbook, manually copied the worksheets, entered the code into the workbook.  It did not work and spent a lot of time yesterday to no avail.  Got up this a.m. and a bunch of emails had arrived with all the test runs from day before and yesterday.  I appears to be working but I'm going to run one more test.  I am going to make a copy of the workbook because I want it to run all the worksheets that have TODAY's date in any column to send me an alert.  If you would like, I will let you know how that turns out.  Thank you so much for all of your help and I am sorry that your code did not work because of my computer.  You have a GREAT!! day.

----------


## gmr4evr1

No worries, and yes, please let us know how it goes.

----------


## MARILYNMING

Still having lots of trouble.  I try to close the entire Excel app. but I find the Excel session is still running in Windows Task Manager.  I am going to create a new workbook, send it to my son and then delete what I have on my desktop.  I'm sure there are better ways but feeling like a mushroom right now.  I'm still trying to code an array for the entire workbook to check each sheet for certain columns for today's DATE.  You will remember that I had it for two columns but have been unable to figure out how to add more.  I hope I am not bothering you with all my 'chatting'.

----------


## gmr4evr1

No worries about the "chatting".
Can you attach a desensitized version of the workbook you are using with any code you have in it?

----------


## MARILYNMING

What I have done:  I have created a new workbook with one spreadsheet that I have copied from the original (nothing sensitive)and hopefully have attached correctly.  What I want:  I would like to insert a VBA module for each WORKSHEET to auto email for DATE from COLUMNS.  I have found that creating a module for the WORKBOOK won't work for me since each worksheet has a different message (SUBJECT, BODY) and different COLUMNS).  You would do me a huge favor if you would give me the VBA and then variable for one, two, three  columns in the code and I will be able to choose which columns I want from each worksheet.  Thank you so much for your help!  You must be a wonderful person to take time out from your day to help other people and I really appreciate it!

----------


## MARILYNMING

I have updated the code for the workbook.  I am still having trouble adding additional columns to the code. As you can see, I need to be able to have the code check more columns for DATE. Thanks, again, for all your time and effort.

----------

