0
私はVBAの知識が非常に限られています。 私はリードコンタクトのスプレッドシートを持っています。私は選択した特定の人に電子メールを送信し、電子メールの本文に連絡先情報を返すドロップダウンリストを設定したいと思います。電子メールを自動入力する方法はわかりません。現時点では、ポップアップする電子メールは、セル内のテキスト値を返すのではなく、連絡先情報の本文に「true」を持っています。どのくらい正確にこれを修正するコードを追加するのですか?エクセルのスプレッドシートからリードアサインメントメールを作成
Sub DropDown7_Change()
Dim answer As String
answer = MsgBox("Are you sure you want to assign this lead?", _
vbYesNo, "Send Email")
' Above code informs the user that an automated email will be sent
'Code uses the users answer to either carryout the generated email process or to not save the changes.
If answer = vbNo Then Cancel = True
If Cancel = True Then Exit Sub
If answer = vbYes Then
'Connects to outlook and retrieves information needed to create and send the email.
Set OutlookApp = CreateObject("Outlook.Application")
Set OlObjects = OutlookApp.GetNamespace("MAPI")
Set newmsg = OutlookApp.CreateItem(olMailItem)
'Contains the email address of the person receiving the email.
newmsg.Subject = "Lead Assigned to You" 'Sets the automated subject line to the email
newmsg.Body = "Hello," & vbNewLine & _
"You have been assigned a lead. Please follow up with the contact" & vbNewLine & _
ActiveCell.Offset(0, 3).Range("K5").Select
ActiveCell.Offset(0, 6).Range("K5").Select
ActiveCell.Offset(0, 7).Range("K5").Select
'Above code has the body of the automated email
newmsg.Display
End If
End Sub ' End of function