Hi,
Im having trouble trying to pull data from a userform into an email body. See below for code.
aemail.body section is not pulling anything from the userform.
Any ideas?
Im having trouble trying to pull data from a userform into an email body. See below for code.
VBA Code:
Dim aOutlook As Object
Dim aEmail As Object
Dim rngeAddresses As Range, rngeCell As Range, strRecipients As String
If UserForm1.failtb.Value > UserForm1.RejectTB.Value Then
'If ActiveWorkbook.Path <> "" Then
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 = "Test" & UserForm1.dat1.Value & Chr(10) & _
"Test 2" & UserForm1.CommentsTB.Value & Chr(10) & _
"Revenue" & UserForm1.ListBox3.Value
'send one off to 1 person use this static code
'aEmail.Recipients.Add "E-mail.address-here@ntlworld.com"
aEmail.Recipients.Add "dans@teamsmt.local"
'Send Mail
aEmail.Send
aemail.body section is not pulling anything from the userform.
Any ideas?