chungtinhlak
02-24-2009, 07:01 AM
Hi, this is my first time writing a macro in outlook, can someone tell me what is wrong with this.
Option Explicit
Sub dailyexitandarrival()
Dim objmail As Outlook.MailItem
Dim myattachements As Collection
Set objmail = Outlook.CreateItem(olMailItem)
With objmail
.BodyFormat = olFormatPlain
.Body = "Good Morning All, attached is Daily Exits and Arrivals. Please Click cancel when asked to updated."
.Display
.To = "John@smith.com"
End With
Set myattachements = objmail.Attachments
myattachements.Add "C:\\daily-arrivals-exits.ppt"
objmail.Send
End Sub
Option Explicit
Sub dailyexitandarrival()
Dim objmail As Outlook.MailItem
Dim myattachements As Collection
Set objmail = Outlook.CreateItem(olMailItem)
With objmail
.BodyFormat = olFormatPlain
.Body = "Good Morning All, attached is Daily Exits and Arrivals. Please Click cancel when asked to updated."
.Display
.To = "John@smith.com"
End With
Set myattachements = objmail.Attachments
myattachements.Add "C:\\daily-arrivals-exits.ppt"
objmail.Send
End Sub