0
我的VBA知識極其有限。 我有一個領導聯繫人的Excel電子表格。我想設置一個下拉列表,向我選擇的特定人員發送電子郵件,然後返回電子郵件正文中的聯繫人信息。我不知道如何讓電子郵件自動填充,現在,彈出的電子郵件在聯繫人信息的正文中具有「真實」,而不是返回單元格中的文本值。如何以及在哪裏我添加代碼來解決這個問題?從excel電子表格中制作主題分配電子郵件
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