Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,259
- Office Version
- 2010
- Platform
- Windows
Hi good morning, hope you can help me please, i have the code below where i have put an encryption in for emails, but i am getting an error on the line below please can you help?
I get an eror on this line -
I get an eror on this line -
Code:
aEmail.PropertyAccessor.SetProperty PR_SECURITY_FLAGS, (ulFlags)
VBA Code:
Private Sub CommandButton2_Click()
Const PR_SECURITY_FLAGS = "http://schemas.microsoft.com/mapi/proptag/0x6E010003%22"
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("Work Issue")
Set rngDataToEmail = .Range("B1:R" & .Range("B" & Rows.Count).End(xlUp).Row)
End With
aEmail.HTMLBody = "<html><body><p>Hi " & Me.TextBox9.Value & "</p>" _
& "<p>" & Me.ComboBox2.Value & "</p>" _
& "<p>" & Me.ComboBox3.Value & "</p>" _
& "<p>" & Me.TextBox1.Value & "</p>" & RangetoHTML(rngDataToEmail) _
& "<p>Many Thanks</p>" _
& "<p>Complex Team</p>" _
& "</body></html>"
aEmail.Recipients.Add (UserForm1.TextBox2.Value)
aEmail.CC = (UserForm1.TextBox3.Value)
aEmail.BCC = ""
aEmail.Subject = (UserForm1.TextBox6.Value) & (UserForm1.TextBox8.Value) & (UserForm1.ComboBox4.Value)
aEmail.Display
Unload Me
End Sub