These NoteItem methods require a NoteItem object be passed to each. Each of the functions below includes sample VBA code. See The NoteItem Object for sample code to create NoteItems in several ways.
Close Method
Function CloseNote(note As Outlook.NoteItem, SaveNote As _
Outlook.OlInspectorClose)
note.Close SaveNote
End Function
Sub Test()
Dim note As Outlook.NoteItem
Set note = Outlook.CreateItem(olNoteItem)
Call CloseNote(note)
End Sub
Copy Method
Function CopyNote(note As Outlook.NoteItem) As Outlook.NoteItem Set CopyNote = note.Copy End Function Sub Test() Dim note As Outlook.NoteItem Set note = Outlook.CreateItem(olNoteItem) End Sub
Delete Method
Function DeleteNote(note As Outlook.NoteItem) note.Delete End Function Sub Test() Dim note As Outlook.NoteItem Set note = Outlook.CreateItem(olNoteItem) Call DeleteNote(note) End Sub
Display Method
Place the Enum section at the top of a standard module, above any functions or procedures (Sub).
Public Enum displayMode vbModeless vbModal End Enum Function DisplayNote(note As Outlook.NoteItem, Optional displayMode As displayMode = vbModal) note.Display displayMode End Function Sub Test() Dim note As Outlook.NoteItem Set note = Outlook.CreateItem(olNoteItem) Call DisplayNote(note, vbModal) End Sub
Move Method
Function MoveNote(note As Outlook.NoteItem, _
fldr As Outlook.MAPIFolder) As Outlook.NoteItem
Set MoveNote = note.Move(fldr)
End Function
Sub Test()
Dim note As Outlook.NoteItem
Dim movedNote As Outlook.NoteItem
Dim fldr As Outlook.MAPIFolder
Set note = Outlook.CreateItem(olNoteItem)
Set fldr = Session.GetDefaultFolder(olFolderNotes).Folders("My Notes Subfolder")
Set movedNote = MoveNote(note, fldr)
End Sub
Print Method
Function PrintNote(note As Outlook.NoteItem) note.PrintOut End Function Sub Test() Dim note As Outlook.NoteItem Set note = Outlook.CreateItem(olNoteItem) Call PrintNote(note) End Sub
Save Method
Function SaveNote(note As Outlook.NoteItem) note.Save End Function Sub Test() Dim note As Outlook.NoteItem Set note = Outlook.CreateItem(olNoteItem) Call SaveNote(note) End Sub
SaveAs Method
Function SaveNoteAs(note As Outlook.NoteItem, filePath As String, _
Optional fileType As OlSaveAsType = olTXT)
note.SaveAs filePath, fileType
End Function
Sub Test()
Dim note As Outlook.NoteItem
Set note = Outlook.CreateItem(olNoteItem)
Call SaveNoteAs(note, "C:\My Note.txt")
End Sub
