vba macro

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » vba macro in outlook

vba macro in outlook

resolvedResolved · 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 courses

 

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
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Change Excel's default font

You can change the default font and font size for all spreadsheets created in Excel by:

1. Going to Tools on the menu bar.
2. Select Options, then General.
3. Next to Standard Font you can change the font and font size.
4. Click OK.

Each new file you start from this point onward should use the font and font size you have selected.

View all Excel hints and tips


Server loaded in 0.09 secs.