Ida has attended:
Introduction to Management course
Excel VBA Advanced course
Presentation Skills course
vba macro in outlook
object required in vba macro in outlook
copied the codes, but still the object is not being defined
RE: vba macro in outlook
Hi Ida,
Thank you for the forum question.
Late Binding:
The below code is if you do not activate the Outlook Object Library.
Sub sendemail()
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = "xxxx@xxxx.com"
.CC = ""
.BCC = ""
.Subject = " Monthly report for month " & Format(Date, "mmmm")
.Body = "Hello World!" & vbCrLf & "New line text"
.Attachments.Add "Enter the file path here"
.Display
'.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Sub sendemail()
Early Binding:
The below code is if you activate the Outlook Object Library
Sub sendemail()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "xxxx@xxxx.com"
.CC = ""
.BCC = ""
.Subject = " Monthly report for month " & Format(Date, "mmmm")
.Body = "Hello World!" & vbCrLf & "New line text"
.Attachments.Add "Enter the file path here"
.Display
'.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
I hope this makes sense.
Kind regards
Jens Bonde
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector