Saturday 4 May 2013

Export Outlook Notes to Text file

If you want to export or convert your outlook notes to a text file from your outlook client, please follow below steps. You don't need to have Visual Basic knowledge because the steps and codes are all here:

  1. First create a folder in your C: drive e.g. C:\foldername\notes
  2. Open your Outlook client, then go to your notes folder.
  3. Press ALT-F11 which will open Outlook's Visual Basic window. If it does not open, be sure you clicked on the top bar of the Outlook window and press ALT-F11 again.
  4. On the top toolbar, click on Insert and Module. You should see a new window pane open labelled Project1, Module1.
  5. Copy the code listed below and paste it in the Module1 window pane. (this code will export the outlook notes to text files)
  6. On the top toolbar, click on Run and then click on "Run Sub/Userform".
  7. A window will pop up asking you to select the folder where your Outlook Notes are located. Select the Notes folder and then select OK.
  8. The Notes will be exported at this point. "Running" will appear next to "Microsoft Visual Basic" window name at the top of the screen and disappear when the notes are exported successfully.
  9. Close the Microsoft Visual Basic window.
  10. Then Close Outlook. You will receive a popup window asking if you want to save the VBA project. Answer No unless you want to do this again in future.
  11. Check in the Notes folder on the e.g. c:\foldername\notes to find your exported notes in text format.

Sub NotesToText()
Set myNote = Application.GetNamespace("MAPI").PickFolder
For cnt = 1 To myNote.Items.Count
noteName = Replace(Replace(myNote.Items(cnt).Subject, "/", "-"), "\", "-")
myNote.Items(cnt).SaveAs "c:\foldername\notes\" & noteName & ".txt", OlSaveAsType.olTXT
Next
End Sub
 
OR
 
/*with error checking*/
Sub NotesToText()
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:\foldername\filename1.txt", True)
Set myNote = Application.GetNamespace("MAPI").PickFolder
For cnt = 1 To myNote.Items.Count
noteName = Replace(Replace(myNote.Items(cnt).Subject, "/", "-"), "\", "-")
a.WriteLine (noteName)
myNote.Items(cnt).SaveAs "c:\foldername\notes\" & noteName & ".txt", OlSaveAsType.olTXT
Next
End Sub
 
 

No comments:

Post a Comment