Last active
August 12, 2020 12:38
-
-
Save yamatetsu0111/9fc781c4386cff0f5d8a8bb63ef4085f to your computer and use it in GitHub Desktop.
ExcelVBAで宛先や本文や件名を設定するためのコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Sub メール作成2() | |
'メール作成時のおまじない | |
'Outlookアプリケーションオブジェクトの取得 | |
Dim MyOutlook As Outlook.Application | |
Set MyOutlook = New Outlook.Application | |
'メールitemオブジェクトの取得 | |
Dim Mailitem As Outlook.Mailitem | |
Set Mailitem = MyOutlook.CreateItem(olMailItem) | |
'宛先やCcの設定 | |
With Mailitem | |
.To = Range("C2") '宛先 | |
.CC = Range("C3") 'Cc | |
.BCC = Range("C4") 'Bcc | |
.Subject = Range("C6") '件名 | |
.Body = Range("C7") '本文 | |
End With | |
'メールの表示 | |
Mailitem.Display | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment