View Single Post
 
Old 01-05-2019, 02:54 AM
Browny38 Browny38 is offline Windows 10 Office 2016
Novice
 
Join Date: Jan 2019
Posts: 3
Browny38 is on a distinguished road
Default Newsletter in Word needs an unsubscribe vb code for a button.

Hi I feel I am getting close to the answer with this code, but it still needs to be corrected.

Private Sub CommandButton1_Click()
Dim OL As Object
Dim EmailItem As Object
Dim abc As String
'To add to a Word newsletter an Unsubscribe button
Application.ScreenUpdating = False
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(olMailItem)
Application.UserName = "abc"
With EmailItem
.Subject = "Unsubscribed"
.Body = "This person has unsubbed"
.To = "my email@xzy.com"
.Importance = olImportanceNormal
.Attachments.Add abc
.Send
End With
Application.ScreenUpdating = True
End Sub
Reply With Quote