Outlook Notes to Text Files

Here is some code for exporting your Outlook Notes.

Sub NotesToRTF()
    Dim myNote As Variant
    Dim cnt As Integer
    Dim noteName As String
    Dim strExportFolder As String
   
    strExportFolder = "C:\Notes-RTF\"
   
    If Dir(strExportFolder, vbDirectory) = "" Then
        MkDir strExportFolder
    End If
   
    Set myNote = Application.GetNamespace("MAPI").PickFolder
    For cnt = 1 To myNote.Items.Count
        noteName = Trim(Replace(Replace(Replace(Replace(myNote.Items(cnt).Subject, "/", "-"), "\", "-"), ":", ""), vbTab, ""))
        Debug.Print noteName
        myNote.Items(cnt).SaveAs strExportFolder & noteName & ".rtf", OlSaveAsType.olRTF
    Next
   
    Shell "C:\WINDOWS\explorer.exe """ & strExportFolder & "", vbNormalFocus
End Sub

Sub NotesToText()
    Dim myNote As Variant
    Dim cnt As Integer
    Dim noteName As String
    Dim strExportFolder As String
   
    strExportFolder = "C:\Notes-Text\"
   
    If Dir(strExportFolder, vbDirectory) = "" Then
        MkDir strExportFolder
    End If
   
    Set myNote = Application.GetNamespace("MAPI").PickFolder
    For cnt = 1 To myNote.Items.Count
        noteName = Trim(Replace(Replace(Replace(Replace(myNote.Items(cnt).Subject, "/", "-"), "\", "-"), ":", ""), vbTab, ""))
        Debug.Print noteName
        myNote.Items(cnt).SaveAs strExportFolder & noteName & ".txt", OlSaveAsType.olTXT
    Next
   
    Shell "C:\WINDOWS\explorer.exe """ & strExportFolder & "", vbNormalFocus
End Sub

Hope it helps someone else out there.

Comments are closed