#1
|
|||
|
|||
Unsubscribe code for newsletter
Hi I am starting up a monthly newsletter and want to add a unsubscribe button in Vba
I can get the button in position but need the code. Help appreciated. I have written this but it needs editing. Sub UnsubEmail () Dim c1App As Outlook.Application Dim c1Mail As Outlook.MailItem Set c1App = CreateObject(“Outlook.Application”) Set c1Mail = c1App.CreateItem(c1MailItem) c1Mail.To = My Email c1mail.Subject = “Unsubscribe” c1Mail.Body = “Unsubscribe this person” c1Mail.Send ‘Clean Up Set c1App = Nothing Set c1Mail = Nothing End Sub Last edited by Browny38; 01-03-2019 at 05:19 PM. |
#2
|
|||
|
|||
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 |
#3
|
||||
|
||||
Frankly I wouldn't add a button as you cannot force users to run your macros. A hyperlink to your e-mail address would be a more certain bet and no macros required e.g.
{ HYPERLINK "mailto:me@somewhere.com?subject=Unsubscribe" \o "Click here to unsubscribe from this newsletter" }
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#4
|
|||
|
|||
Hi Graham, thank you for the wording. I have 2 computers at home and I sent the newsletter and clicked the unsubscribe link and then a security question appeared and I had to click Y which then went to an email ready to send with another click. I received the email on the other computer. Great. Can I do away with the 2 mouse clicks and just have the link clicked and the rest is automatic?
Browny38 |
#5
|
||||
|
||||
The hyperlink security message can be switched off on your own computers using a registry hack (see below where 16 is the Office version), but you cannot switch it off on the recipients computers. How they have their security options configured is a matter for them to determine.
HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\C ommon Beneath Common, locate the Security subkey. If there isn't a Security subkey, create it. Beneath Security, add a new DWORD value named DisableHyperlinkWarning and set its value to 1
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Electronic Newsletter | MaineLady | Word | 1 | 09-11-2016 06:16 PM |
Problems sending html newsletter | vanderloo | Outlook | 0 | 11-08-2012 11:31 AM |
unneccesary gap in newsletter, please help! | slain | Outlook | 0 | 05-07-2011 03:44 AM |
Email marketing help - "Unsubscribe" Footer | DoughMan | Outlook | 0 | 04-06-2011 10:57 AM |
Curve the Text Box in a Newsletter? | lewiedude | Publisher | 2 | 11-08-2005 08:52 AM |