adding data from combobox if checkbox is clicked on into email

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,259
Office Version
  1. 2010
Platform
  1. Windows
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]
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top