I have a function that creates an email via VBA.
I made this through Excel 2016. When some of my colleagues try to use it there an error of missing references (Outlook Library 16.0).
I looked in the internet for solutions and found the best is Late Binding. I have read about it but I don't understand how to make it work in the following example code.
Sub EscalateCase(what_address As String, subject_line As String, email_body As String)
Dim olApp As Outlook.Application
Set olApp = CreateObject("Outlook.Application")
Dim olMail As Outlook.MailItem
Set olMail = olApp.CreateItem(olMailItem)
olMail.To = what_address
olMail.Subject = subject_line
olMail.BodyFormat = olFormatHTML
olMail.HTMLBody = email_body
olMail.Send
End Sub
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…