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

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Watch MrExcel Video

Forum statistics

Threads
1,101,851
Messages
5,483,322
Members
407,393
Latest member
GeorgeBrown

This Week's Hot Topics

  • Finding issue in If elseif else with For each Loop
    Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
  • MsgBox Error
    Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
  • CELL FORMAT - IF CONDITION
    My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
  • Show numbers nearly the same
    Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...
  • Please i need your help to create formula
    I need a formula in cell B8 to do this >>if b1=1 then multiply ( cell b8) by 10% ,if b1=2 multiply by 20%,if=3 multiply by 30%. Thank you in...
  • Got error while adding column and filter
    Got error while adding column and filter In column Z has some like "Success" and "Error". I want to add column in AA if the Z cell value is...
Top