# Scheduling daily emailing of an excel file



## PTProgram (Apr 25, 2004)

If I have an excel file that is automatically updated each night and then I want to email it to someone, is done through excel vba or outlook vba? I use office 2003. Ideally, I would like to start saving the file that updates as a html file that will be saved in the same place and then email the html file everyday.  

Any ideas?


----------



## Smitty (Apr 25, 2004)

See: http://www.rondebruin.nl/sendmail.htm for just about all the tricks you'll need for e-mailing with Outlook/Excel.

As for when you want it to run, you can schedule the event with:
	
	
	
	
	
	



```
Private Sub Workbook_Open()
     Application.OnTime TimeValue("15:00:00"), "MyMacro"
End Sub
```
Change the time to reflect the time that you want the workbook sent and "MyMacro" to the name of the e-mail macro that you create.

The e-mail code will go in a general module, while the Workbook_Open code will go in the ThisWorkbook module.

Hope that helps,

Smitty

EDIT: Typo


----------



## PTProgram (Apr 25, 2004)

Thanks. Looked at the site but unclear if any code actually goes into outlook VBA or is it all in Excel?  The actual file is an html file, so not sure how to go about it.


----------



## Smitty (Apr 25, 2004)

The code goes in Excel VBA and you should be able to send the HTML document by sending after you save it as HTML.

Smitty


----------



## shoctor (Feb 20, 2019)

Hello!  This doesn't seem to work.  I know this post is old....maybe something has changed since excel 2013.  I'm using 365.


----------

