添加用户表单input到电子邮件正文的电子邮件VBA代码

我需要能够从Excel发送电子邮件,但是我希望电子邮件正文包含用户表单中的值,然后按下提交。

我已经尝试了不同的事情,但我坚持下面的代码。

Dim aOutlook As Object Dim aEmail As Object Dim rngeAddresses As Range, rngeCell As Range, strRecipients As String Set aOutlook = CreateObject("Outlook.Application") Set aEmail = aOutlook.CreateItem(0) 'set Importance aEmail.Importance = 2 'Set Subject aEmail.Subject = "TestMailSend" 'Set Body for mail aEmail.Body = "Campaign Name" & Me.ComboBox5.Value "Job Number" & Me.ComboBox4.Value "Revenue" & Me.ComboBox3.Value 'send one off to 1 person use this static code 'aEmail.Recipients.Add "E-mail.address-here@ntlworld.com" aEmail.Recipients.Add "Insert email address here" 'Send Mail aEmail.Send 

也许你应该改变以下内容:

 'Set Body for mail aEmail.Body = "Campaign Name: " & Me.ComboBox5.Value & chr(10) & _ "Job Number: " & Me.ComboBox4.Value & chr(10) & _ "Revenue: " & Me.ComboBox3.Value 

&合并两个值, chr(10)添加一个换行符, _让你写多行代码。

HTH;)