Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,259
- Office Version
- 2010
- Platform
- Windows
Hi good afternoon please can you help me please with the below code. Compile error: method or data member not found on Me.Label2.Text, line and Private Sub CommandButton2_Click() is highlighted with a yellow background. Hope you can help me please to why i am getting this error. i have also got a module 3 for this code to work.
VBA Code:
Private Sub CommandButton2_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
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.TextBox13.Value & "</p>" & _
"<table border=""1"", cellpadding=""10"", style=background:""#a6bbde"" >" & _
"<tr>" & _
"<td>" & Me.Label2.Text & "</td><td>" & Me.TextBox1.Text & "</td>" & _
"<td>" & Me.Label3.Text & "</td><td>" & Me.TextBox2.Text & "</td>" & _
"<td>" & Me.Label1.Text & "</td><td>" & Me.TextBox10.Text & "</td>" & _
"</tr>" & _
"<tr>" & _
"<th>Address:</th>" & _
"<td>" & Me.Labell.Value & "</td><td>" & Me.TextBox6.Value & "</td>" & _
"<td>" & Me.Label2.Value & "</td><td>" & Me.TextBox7.Value & "</td>" & _
"<td>" & Me.Label3.Value & "</td><td>" & Me.TextBox8.Value & "</td>" & _
"<td>" & Me.Label14.Value & "</td><td>" & Me.TextBox8.Value & "</td>" & _
"</tr>" & _
"<th>Job:</th>" & _
"<td>" & Me.Label6.Value & "</td><td>" & Me.TextBox8.Value & "</td>" & _
"<td>" & Me.Label7.Value & "</td><td>" & Me.TextBox8.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 = "Daily " & (UserForm6.ComboBox2.Value)
aEmail.Display
Unload Me
End Sub