View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Automatically EMailing a Spreadhsheet Upon Opening

Rod,

Put the code below into a module (making changes as needed to the subject,
address, and message), set a reference to MS Outlook using Tools |
References.... and use the open event or an auto-open macro to run it.

HTH,
Bernie
MS Excel MVP

Sub EmailThisWorkBookNow()
Dim ol As Object
Dim myItem As Outlook.MailItem
Dim myMsg As String
Dim myAtts As Outlook.Attachments

Set ol = CreateObject("outlook.application")

myMsg = "Hi Rod," & Chr(10) & Chr(10)
myMsg = myMsg & "Here's that stupid file.... AGAIN!" & Chr(10) & Chr(10)
myMsg = myMsg & " Rod" & Chr(10)

Set myItem = ol.CreateItem(olMailItem)
myItem.to = "
myItem.Subject = "Subject Line"
myItem.Body = myMsg
Set myAtts = myItem.Attachments
myAtts.Add ThisWorkbook.FullName
myItem.Send

Set ol = Nothing

End Sub

"Rod" wrote in message
...
I have a spreadsheet I would like to automatcially email itself upon

opening.
It will always go to the same address. I use MS Outlook and Excel 2003.

Is
this possible?

I am comfortable w/ Excel and Outlook put am not an accomplished

programmer.
Is there help out there?

Thanks.