98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » vba macro in outlook
vba macro in outlook
Resolved · High Priority · Version 2016
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
Wed 29 Aug 2018: Automatically marked as resolved.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Change Excel's default fontYou can change the default font and font size for all spreadsheets created in Excel by: |