Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,259
- Office Version
- 2010
- Platform
- Windows
Hi good evening. hope you can help me please, i have the code below which isnt working at all i have rearranged it so the layout on the email is different, but as i have been moving all the label.caption together on one row and then the TextBox.text or value on another row it doesnt work, the whole lot of code is highlighted in red. Also on some lines it wont let me put the '_' after the '&', please can you help me
VBA Code:
Private Sub CommandButton2_Click()
If ComboBox2.Value = "" Then
MsgBox "Please enter 'Allocated To EOD'"
Exit Sub
Else
End If
Const PR_SECURITY_FLAGS = "http://schemas.microsoft.com/mapi/proptag/0x6E010003"
Dim aOutlook As Object
Dim aEmail As Object
Dim ulFlags As Integer
Dim rngeAddresses As Range, rngeCell As Range, strRecipients As String
Set aOutlook = CreateObject("Outlook.Application")
Set aEmail = aOutlook.CreateItem(0)
ulFlags = ulFlags Or &H1 ' SECFLAG_ENCRYPTED
aEmail.PropertyAccessor.SetProperty PR_SECURITY_FLAGS, (ulFlags)
aEmail.HTMLBody = "<html><body>" & _
"<p>Hi " & Me.TextBox14.Value & "</p>" & _
"<table border=""1"", cellpadding=""10"", style=background:""0xFFFFFF"" >" & _
"<tr>" & _
"<th>Details:</th>" & _
"<tr>" & _
"<td>" & Me.Label12.Caption & "</td>" & _
"<td>" & Me.Label7.Caption & "</td>" & _
"<td>" & Me.Label13.Caption & "</td>" & _
"<td>" & Me.Label14.Caption & "</td>" & _
"<td>" & Me.Label6.Caption & "</td>" & _
"<td>" & Me.Label1.Caption & "</td>" & _
"<td>" & Me.Label2.Caption & "</td>" & _
"<td>" & Me.Label3.Caption & "</td>" & _
"<td>" & Me.Label4.Caption & "</td>" & _
"<tr>" &
"<td>" & Me.TextBox1.Text & "</td>" & _
"<td>" & Me.TextBox2.Value & "</td>" & _
"<td>" & Me.TextBox3.Text & "</td>" & _
"<td>" & Me.TextBox4.Value & "</td>" & _
"<td>" & Me.TextBox5.Text & "</td>" & _
"<td>" & Me.TextBox6.Value & "</td>" & _
"<td>" & Me.TextBox7.Value & "</td>" & _
"<td>" & Me.TextBox8.Value & "</td>" & _
"<td>" & Me.TextBox9.Value & "</td>" & _
"</table>" &_
"<br><br><br><br><br><br>" & _
"<p>Many Thanks</p>" & _
"<p>Complex Team</p>" & _
"</body></html>"
aEmail.Recipients.Add (UserForm6.TextBox13.Value)
aEmail.CC = ""
aEmail.BCC = ""
aEmail.Subject = (UserForm1.Label10.Caption) & (UserForm1.TextBox8.Value)
aEmail.Display
Unload Me
End Sub