adding data from combobox if checkbox is clicked on into email

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,036
Hi goodafternoon,




I have thecode below where I am trying to add another line after the Comments which iswith a checkbox. I want to add ‘ Job Type’ as a heading
and the ComboBox6 Data if the Checkbox1 isclicked, can you help please?

HTML:
[FONT=Times New Roman][/FONT]
Private SubCommandButton2_Click()
[FONT=Times New Roman]
[/FONT]
    If TextBox9.Value = "" Then
[FONT=Times New Roman]
[/FONT]
        MsgBox "Please enter'Comments'"
[FONT=Times New Roman]
[/FONT]
        Exit Sub
[FONT=Times New Roman]
[/FONT]
    Else
[FONT=Times New Roman]
[/FONT]
 
[FONT=Times New Roman]
[/FONT]
    End If
[FONT=Times New Roman]
[/FONT]
 
[FONT=Times New Roman]
[/FONT]
Dim aOutlookAs Object
[FONT=Times New Roman]
[/FONT]
Dim aEmailAs Object
[FONT=Times New Roman]
[/FONT]
DimrngeAddresses As Range, rngeCell As Range, strRecipients As String
[FONT=Times New Roman]
[/FONT]
 
[FONT=Times New Roman]
[/FONT]
Set aOutlook= CreateObject("Outlook.Application")
[FONT=Times New Roman]
[/FONT]
Set aEmail =aOutlook.CreateItem(0)   
[FONT=Times New Roman]
[/FONT]
 
[FONT=Times New Roman]
[/FONT]
        aEmail.htmlBody = "Hi There,"& Chr(10) & vbCrLf & _
[FONT=Times New Roman]
[/FONT]
                      "<p>ApptNumber: " & Me.TextBox8.Value & Chr(10) & _
[FONT=Times New Roman]
[/FONT]
                     "<p><p>MPAN / MPRN: " & Me.TextBox7.Value& Chr(10) & _
[FONT=Times New Roman]
[/FONT]
                      "<p>Post Code:" & Me.TextBox3.Value & Chr(10) & _
[FONT=Times New Roman]
[/FONT]
                     "<p><p><font color=black>" &"<span style='background:yellow;mso-highlight:yellow'>" &"<b>Comments:</b>" & Me.TextBox9.Value & Chr(10)& "</font></span>" & _
[FONT=Times New Roman]
[/FONT]
[COLOR=#747474][FONT="Courier New"]    [/FONT][/COLOR]If UserForm3.CheckBox1.Value = TrueThen
[FONT=Times New Roman]
[/FONT]
[COLOR=#747474][FONT="Courier New"]       [/FONT][/COLOR]"<p><p>Job Type:" & Me.ComboBox6.Value & Chr(10) & vbCrLf & _
[FONT=Times New Roman]
[/FONT]
End If
[FONT=Times New Roman]
[/FONT]
                      "</b><p>Activity:" & Me.ComboBox3.Value & Chr(10) & _
[FONT=Times New Roman]
[/FONT]
                     "<p><p>Action: " & Me.ComboBox1.Value &Chr(10) & vbCrLf & _
[FONT=Times New Roman]
[/FONT]
                      "<p>Manythanks " & Chr(10)
[FONT=Times New Roman]
[/FONT]
 
[FONT=Times New Roman]
[/FONT]
        aEmail.Recipients.Add(Worksheets("Email Links").Range("A2").Value)
[FONT=Times New Roman]
[/FONT]
    
[FONT=Times New Roman]
[/FONT]
        aEmail.CC = ""
[FONT=Times New Roman]
[/FONT]
        aEmail.BCC = ""
[FONT=Times New Roman]
[/FONT]
        aEmail.Subject = "IN DAYREQUEST> PLEASE BOOK FOR TODAY" & " " &Worksheets("Handover").Range("K1").Value
[FONT=Times New Roman]
[/FONT]
        aEmail.Display
[FONT=Times New Roman]
[/FONT]
 
[FONT=Times New Roman]
[/FONT]
 
[FONT=Times New Roman]
[/FONT]
End Sub    
[FONT=Times New Roman][/HT[/FONT]ML]

[/COLOR][/SIZE]

[/FONT]



[FONT=Times New Roman][SIZE=3][COLOR=#000000][/COLOR][/SIZE][/FONT]
 

Some videos you may like

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Watch MrExcel Video

Forum statistics

Threads
1,102,336
Messages
5,486,250
Members
407,538
Latest member
kbendelac

This Week's Hot Topics

Top