Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,259
- Office Version
- 2010
- Platform
- Windows
Hello good afternoon, hope you can help me please? i have the code below but it is all in red, i am trying to put a border around the email data that is copied over from a sheet called 'Raised', hope you can help please.
VBA Code:
Private Sub CommandButton3_Click()
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
Dim rngDataToEmail As Range
Set aOutlook = CreateObject("Outlook.Application")
Set aEmail = aOutlook.CreateItem(0)
ulFlags = ulFlags Or &H1 ' SECFLAG_ENCRYPTED
aEmail.PropertyAccessor.SetProperty PR_SECURITY_FLAGS, (ulFlags)
With Sheets("Raised")
Set rngDataToEmail = .Range("B1:Q" & .Range("B" & Rows.Count).End(xlUp).Row)
End With
aEmail.HTMLBody = "<html><body><p>Hi " & Me.TextBox9.Value & "</p>" _
"<table border=""1"", cellpadding=""10"", style=background:""0xFFFFFF"" >" & _
"<td>" & Me.ComboBox2.Value & "</td>" & _
"<td>" & RangetoHTML(rngDataToEmail) & "</td>" & _
"<td>" & Any issues let your FTL know ASAP"</td>" & _
"<td>" & "<p>Many Thanks & "</td>" & __
"<td>" & "<p>Complex Team & "</td>" & _
"<td>" & "</body></html>"
"</tr>" & _
"</table>" & _
"<br><br><br><br><br><br>" & _
"<p>Any issues, please contact your FTL.</p>" & _
"<p>Many Thanks</p>" & _
"<p>Complex Team</p>" & _
"</body></html>"
aEmail.Recipients.Add (UserForm8.TextBox21.Value)
aEmail.CC = ""
aEmail.BCC = ""
aEmail.Subject = (UserForm1.TextBox8.Value)
aEmail.Display
Unload Me
Dim Cll As Range
Dim sh As Worksheet, f As Range
Set sh = Sheets("Raised")
Set f = sh.Range("B2:B1000").Find(ComboBox2.Value, , xlValues, xlWhole)
If Not f Is Nothing Then
sh.Select
f.Select
Else
MsgBox "Does not exist"
End If
For Each Cll In sh.Range("B2:B1000")
If Cll.Value = f Then
Cll.Interior.Color = vbGreen
End If
Next Cll