I want to be able to send an automated email through outlook express which attaches an excel spreadsheet.
I have the following code which i used to use in outlook, but will not not work in my current set up.
I've tried changing the Dim statment to look for outlook express rather than outlook but does not seem to like this either.
Do I need an add in to allow me to do this, or can anyone suggest anything else
Thanks
K
Sub Send()
'Dim objOutlook As outlookexpress.Application
Dim objmessage As outlook.MailItem
Dim objAttach As outlook.Attachments
'Creates objects to send mail
Set objOutlook = CreateObject("Outlook.Application")
Set objmessage = objOutlook.CreateItem(olMailItem)
Set objAttach = objmessage.Attachments
'Loads data into fields
objmessage.To = "robert smith ; martin Gore"
objmessage.Subject = "Stock Booked in By Day (DPS Report & Ret Report)"
'This is the messgage in the body of email that recipients see
objmessage.Body = "Dear All" & Chr(13) _
& "Please find attached the files containing stock booked in and returned by day " & Chr(13) & Chr(13) & Chr(13) _
& "Regards" & Chr(13) & Chr(13)
'Attach's file to message depending if Sunday then attach full week file.
'If Weekday(Now) = 1 Then
objAttach.Add "\\hmvnetapp1\data\finsys\daily\DPS Report.xls"
objAttach.Add "\\hmvnetapp1\data\finsys\daily\RET Report.xls"
'Else
'objAttach.Add "\\hmvnetapp1\strpublic\Finance\BaseBookingInReport.xls"
'End If
'Sets in expiriy time, just a housekeeping thing
objmessage.ExpiryTime = Date + 2
objmessage.Display
End Sub
Bookmarks