At times, you may hope to edit or add notes to you emails in Outlook. This article will introduce you an effective way to achieve this function.
From “4 Easy Methods to Insert a Note into Your Outlook Messages“, you can learn to insert notes into mails via Outlook native functions, such as using custom flags, typing note in subject or body, or attaching existing note items to this email. Yet, all of them are just workarounds. Here, we’ll teach you a much more effective method. Via it, you will be able to add notes to emails and edit or delete existing notes at will.
Add Notes to Outlook Emails
- To begin with, access VBA editor by pressing “Alt + F11” in Outlook.
- Then, click “Insert” > “UserForm”.
- Next, in the new UserForm, create a textbox like the image below.
- Then, change the “Name” of the textbox to “txtNotes”, like the screenshot.
- After that, create two commandbuttons in the form.
- Then, select “CommandButton 1”. Change its “Name” to “btnOK” and alter its “Caption” to “OK”.
- Afterwards, alter the “Name” of “CommandVutton 2” to “btnCancel” and the “Caption” to “Cancel”.
- Next, select the entire UserForm and modify its “Name” to “frmAddNote” and “Caption” to “Enter your note”.
- Subsequently, right click the “fromAddNote” and choose “View Code”.
- In the new screen, copy the following code into it.
Private Sub btnOK_Click() Dim strNote As String Dim objMail As Outlook.MailItem Dim objNote As Outlook.NoteItem strNote = txtNotes.Text Set objMail = Application.ActiveExplorer.Selection.Item(1) Set objNote = Application.CreateItem(olNoteItem) objNote.Body = strNote objNote.Save objMail.Attachments.Add objNote objMail.Save objNote.Delete Unload Me End Sub Private Sub btnCancel_Click() Unload Me End Sub
- Later, put the VBA code below into an unused module.
Sub AddNote() frmAddNote.Show End Sub
- Finally, head to “File” > “Options” > “Customize Ribbon” to add this macro to ribbon.
- Now, you can have a try. Select an email and click the new “Add Note” button in ribbon.
- In the popup dialog box, you can enter you note and click “OK”.
- Immediately, a new note will be added to the selected email.
Edit or Delete Existing Notes for Outlook Emails
At times, you may want to edit or delete any existing notes in an email. You can follow the steps below.
- First off, create another userform and name it as “frmEditNote” and modify its caption to “Edit your note”.
- Then, insert a new textbox in the form and change its “Name” to “txtNotes”.
- Next, add two commandbuttons – “OK” and “Cancel”.
- After that, right click “frmEditNote” and select “View Code”.
- In the new code page of “frmEditNote”, put the following code.
Private Sub UserForm_Initialize() Dim objAttachNote As Outlook.Attachment Dim objTempNote As Outlook.NoteItem Set objAttachNote = ActiveExplorer.AttachmentSelection.Item(1) Set objMail = objAttachNote.Parent If Right(objAttachNote.FileName, 3) = "msg" Then strTempFolder = Environ("Temp") strFilePath = strTempFolder & "\" & objAttachNote.FileName objAttachNote.SaveAsFile strFilePath End If Set objTempNote = Session.OpenSharedItem(strFilePath) txtNotes.Text = objTempNote.Body objTempNote.Close olDiscard End Sub Private Sub btnOK_Click() Dim strNote As String Dim objMail As Outlook.MailItem Dim objAttachNote As Outlook.Attachment Dim objNewNote As Outlook.NoteItem strNote = txtNotes.Text Set objNewNote = Application.CreateItem(olNoteItem) Set objMail = Application.ActiveExplorer.Selection.Item(1) Set objAttachNote = ActiveExplorer.AttachmentSelection.Item(1) objAttachNote.Delete objNewNote.Body = strNote objNewNote.Save objMail.Attachments.Add objNewNote objMail.Save objNewNote.Delete Unload Me End Sub Private Sub btnCancel_Click() Unload Me End Sub
- After that, open a module and copy the VBA code into it.
Sub EditNote() frmEditNote.Show End Sub Sub DeleteNotes() Dim objSelectedAttachments As Outlook.AttachmentSelection Dim objAttachment As Outlook.Attachment Dim objMail As Outlook.MailItem Set objSelectedAttachments = Application.ActiveExplorer.AttachmentSelection For Each objAttachment In objSelectedAttachments If Right(objAttachment.FileName, 3) = "msg" Then objAttachment.Delete End If Next Set objMail = Application.ActiveExplorer.Selection.Item(1) objMail.Save End Sub
- Finally, you can add the “EditNote” and “DeleteNotes” macros to ribbon.
- Lastly, after click “OK” and return to the main window, you can try to edit a note.
- Select a note and click the “Edit Note” button.
- Then, a new dialog box will show up, in which you can edit the selected note.
- After editing, click “OK”. The note will be updated.
- Also, you can try to delete any notes.
- Select the note you want to delete.
- Click the “Delete Notes” button in ribbon.
- This note will be deleted at once.
Prevent Outlook from Data Loss
Are you searching a mighty solution to block Outlook data loss? In honesty, as long as you make regular Outlook data backups, you can avoid PST data loss with ease. For instance, even if PST gets damaged, you still can easily recover PST data from the backed up PST file like a breeze.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including recover sql and outlook repair software products. For more information visit www.datanumen.com