此代码将打开一个文本文件进行输出,并将每个注释的修改时间和正文写入文本文件。该文件将位于“我的文档”文件夹中,并命名为allnotesyyymmdd.txt。您可以根据您的操作系统和实际需要存储文件的位置更改该路径。
Sub SaveNotes()
Dim fNotes As MAPIFolder
Dim ni As NoteItem
Dim sFile As String
Dim lFile As Long
Set fNotes = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderNotes)
lFile = FreeFile
sFile = Environ$("USERPROFILE") & "\My Documents\AllNotes" & Format(Date, "yyyymmdd") & ".txt"
Open sFile For Output As lFile
For Each ni In fNotes.Items
Print #lFile, "Modified:" & vbTab & ni.LastModificationTime & vbNewLine & ni.Body
Print #lFile, "-------------------------------"
Next ni
Close lFile
End Sub