Function outlook_send_mail(ByVal meAddress As String, ByVal toAddress As String, ByVal ccAddress As String, ByVal bccAddress As String, ByVal subject As String, ByVal body As String) As Variant
Dim outlookObj As Outlook.Application
Dim mailItemObj As Outlook.mailItem
Dim i As Long
Set outlookObj = CreateObject("Outlook.Application")
Set mailItemObj = outlookObj.CreateItem(olMailItem)
mailItemObj.BodyFormat = 3 'リッチテキストに変更
mailItemObj.SentOnBehalfOfName = meAddress
mailItemObj.To = toAddress
mailItemObj.cc = ccAddress
mailItemObj.BCC = bccAddress
mailItemObj.subject = subject
mailItemObj.body = body
mailItemObj.Send
Set outlookObj = Nothing
Set mailItemObj = Nothing
End Function
Function outlook_display_mail(ByVal meAddress As String, ByVal toAddress As String, ByVal ccAddress As String, ByVal bccAddress As String, ByVal subject As String, ByVal body As String) As Variant
Dim outlookObj As Outlook.Application
Dim mailItemObj As Outlook.mailItem
Dim i As Long
Set outlookObj = CreateObject("Outlook.Application")
Set mailItemObj = outlookObj.CreateItem(olMailItem)
mailItemObj.BodyFormat = 3 'リッチテキストに変更
mailItemObj.SentOnBehalfOfName = meAddress
mailItemObj.To = toAddress
mailItemObj.cc = ccAddress
mailItemObj.BCC = bccAddress
mailItemObj.subject = subject
mailItemObj.body = body
mailItemObj.Display
Set outlookObj = Nothing
Set mailItemObj = Nothing
End Function
More than 3 years have passed since last update.
【ExcelVBA×Outlook】ExcelからOutlookメールを送信する
Last updated at Posted at 2021-06-03
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme