Option Compare Database
Private Sub 起動_Click()
Dim olApp As Outlook.Application
Dim olMailMessage As Outlook.MailItem
Dim olRecipient As Outlook.Recipient
Dim blnKnownRecipient As Boolean
Dim strRecip As String
Dim strCc As String
Dim strBcc As String
Dim strSubject As String
Dim strBody As String
'送信先メールアドレスの設定
strRecip = Me.メルアド
'CCの設定
strCc = Me.CC
'BCCの設定
strBcc = Me.BCC
'件名の設定
strSubject = Me.件名
'メール本文の設定
strBody = Me.本文
'Outlookのインスタンスを作成
Set olApp = New Outlook.Application
'メッセージを新規作成
Set olMailMessage = olApp.CreateItem(olMailItem)
'メッセージの内容を設定して送信メール作成
With olMailMessage
Set olRecipient = .Recipients.Add(strRecip)
blnKnownRecipient = olRecipient.Resolve
.CC = strCc
.BCC = strBcc
.Subject = strSubject
.Body = strBody
If blnKnownRecipient Then
'ソフト表示
.Display
End If
End With
Set olMailMessage = Nothing
End Sub