Export Outlook Notes to Document or Text Files

Export Outlook Notes to Document Files

There are a lot of people who want a free way to export their Outlook notes to separate document files. Here is a step by step method of exporting those notes. It may seem tricky, but it really is simple and should take all of 5 minutes to complete. The actual export happens so quickly you will be astonished. The notes will be exported into Word or text documents with the same name as the notes.

Windows does not allow many special characters in file names and the code for exporting the notes will strip every character except A-Z, a-z, and 0-9 from the file name and replace it with a dash. The following device names are also restricted from use as file names by Windows and should not be the name of a note: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. It is up to you to make sure no notes are named any of these special device names.

  • Create a folder on the root (main part) your C: drive named "Notes". It is important that this folder be on the root of the C: drive.
  • Open Outlook.
  • After Outlook opens, click on the top bar of the Outlook window next to the name Microsoft Outlook.
  • 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.
  • On the top toolbar, click on Insert and Module. You should see a new window pane open labeled Project1, Module1.
  • Copy the code you find listed below in this article and paste it in the Module1 window pane. If you wish to export to a document that can be opened in Word (rich text format), use the NotesToRTF code. If you wish to export to text files, use the NotesToText code.
  • On the top toolbar, click on Run and then click on "Run Sub/Userform".
  • A window will pop up asking you to select the folder where your Outlook Notes are located. For most people, this will simply be your normal Outlook Notes folder. Select the Notes folder and then select OK. [More advanced users may select different note folders they may have created, following these steps over and over until all their notes are exported.]
  • The Notes will quickly 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. You may see it flash for a second if you have just a few notes. For hundreds or thousands of notes, it will take longer. Wait for "Running" to go away and you may proceed.
  • Close the Microsoft Visual Basic window.
  • Close Outlook. You will receive a popup window asking if you want to save the VBA project. Answer No.
  • Look in the Notes folder on the C: drive to find your notes.

If you received a "Run time error", click End and then check the following:

  • Did you use a restricted device name for a note?
  • Did you REALLY name the folder Notes in the ROOT of the C: drive?
  • Fix the folder name and then go back to the Microsoft Visual Basic window and click on Run and then "Run Sub/Userform" again.
  • The code is proven and should work every time when you follow the directions. If it still fails, I suspect you may have a corrupted Outlook data file. There are many Hub pages that address how to fix the problem. Simply search for "scanpst" and follow the directions listed in the page.

Update

The new code listed below will strip all characters except A-Z, a-z, and 0-9 from file names and replace them with a dash. The original code is still available below in case you have problems with the new code. The original code will only strip away "/" and "\" characters from note names.

New Notes to RTF Code

Sub NotesToRTF()
    myfolder = "c:\notes\"
    Set sanitize = CreateObject("vbscript.regexp")

    sanitize.IgnoreCase = True
    sanitize.Global = True

    Set myNote = Application.GetNamespace("MAPI").PickFolder
    For cnt = 1 To myNote.Items.Count
        sanitize.Pattern = "((?![a-zA-Z0-9]).)+"
        noteName = sanitize.Replace(myNote.Items(cnt).Subject, "-")
        sanitize.Pattern = "\-+"
        noteName = sanitize.Replace(noteName, "-")
        myNote.Items(cnt).SaveAs myfolder & noteName & ".rtf", OlSaveAsType.olRTF
    Next
End Sub

New Notes to TXT Code

Sub NotesToTXT()
    myfolder = "c:\notes\"
    Set sanitize = CreateObject("vbscript.regexp")

    sanitize.IgnoreCase = True
    sanitize.Global = True

    Set myNote = Application.GetNamespace("MAPI").PickFolder
    For cnt = 1 To myNote.Items.Count
        sanitize.Pattern = "((?![a-zA-Z0-9]).)+"
        noteName = sanitize.Replace(myNote.Items(cnt).Subject, "-")
        sanitize.Pattern = "\-+"
        noteName = sanitize.Replace(noteName, "-")
        myNote.Items(cnt).SaveAs myfolder & noteName & ".txt", OlSaveAsType.olTXT
    Next
End Sub

NotesTo RTF Code

Sub NotesToRTF()
    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:\notes\" & noteName & ".rtf", OlSaveAsType.olRTF
    Next
End Sub

NotesToText Code

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:\notes\" & noteName & ".txt", OlSaveAsType.olTXT
    Next
End Sub

Comments 82 comments

lzhang 6 years ago

Fantastic!!! You're the best.


Remy 6 years ago

Beautiful! Thanks very much - it worked perfectly.


DrDoo 6 years ago

This is exactly what I was looking for. Only problem was with notes that had a blank space at the end of the first line. All I needed to do was remove the space. Thanks


vgo8888 6 years ago

This Guy Rocks! Hat down...


vgo8888 6 years ago

Now - if you can figure how to export them into MAC Notes or MAC Stickies - you will be the KING !!!!!


Deborah 6 years ago

Thanks so much. This has been on my todo list for YEARS!


Isaac 6 years ago

I still get run-time error although I've certainly checked the naming of the folder and location... :(


Emperor Crusher 6 years ago

@Isaac, sorry you are having problems. It has worked wonderfully for so many. Perhaps your Outlook data file is corrupted. Please look up "scanpst" in the Hubpages. The repair procedures may fix some issues. Then rerun the code snippit.


Folk Man 5 years ago

I finally got around to cleaning useful files out of an old computer and this method saved me tons of hours. This was also on my To Do list for years. Now my wife will stop nagging me. Emporer Crusher, you are da' bomb!!!!!


rasqual 5 years ago

Needed to mod it a bit myself:

Replace(Replace(Replace(myNote.Items(cnt).Subject, "/", "-"), "\", "-"), ":", "-")


gpolka 5 years ago

it's great - thanks from Europe as well


Dan 5 years ago

Thank you, that is extremely helpful. Quick and easy.


Yash 5 years ago

Thanks mate. Works like a treat. You saved a lot my time.

Cheers.


meema 5 years ago

If I export my Outlook 2003 Notes to a Word or Text file, does that change anything in the original file? I want the original Outlook Notes to remain the same. I want to use the new exported Notes file to see how it looks after exporting. Before I use your procedure I want to be sure I don't ruin my original files and setup. Your help would be very appreciated! Thank you!


Emperor Crusher 5 years ago

@meema, good question! Your Outlook Notes will always remain the same. This simply exports your notes to files. Remember, when you export them, changes in Outlook notes will not be reflected in the exported notes and vice versa. But you can always export them again which would overwrite any files you still have in the Notes folder on the root of the C: drive. To be clear, that means the old files will be lost and overwritten with what is currently in the Outlook notes. Thanks for asking! If you like this hub, please vote me up! Thanks!


Raymond 5 years ago

I've tried and it exported 1 note then stopped/failed with

Run-time error '-2147467259 (80004005)':

The operation failed.

When I changed the code

For cnt = 1 To myNote.Items.Count

to

For cnt = 2 To myNote.Items.Count

It exported the next note but then exported 1 note then stopped again with the same error. If I repeat changing the above code "cnt = x", it continues exporting 1 note and stops.

Looks like the problem is not looping. If there were syntax error, it would not export at all, right.


Mats 5 years ago

Wonderful! Does it handle notes with the same name? Could that be why its crashing? Perhaps add an "if exist" loop with a counter?


Theo 5 years ago

Thank you, it worked perfectly


Roland 5 years ago

Thank you! It's a life saver.


Oscar 5 years ago

I got an error, but then I checked the "Notes" folder I created and it seems to have worked! Easy! -and i'm not very 'geeky' at all. thx!


Rookie1 5 years ago

This was great! Thank you. Helpful hint for others: I got an "run time error" every time it tried to export a note with a ":" in the title. I needed to remove those from each note and then it exported just fine.


Emperor Crusher profile image

Emperor Crusher 5 years ago from Wichita, KS, USA Author

@Rookie1, you are the second person who commented that you had a problem with a colon in your note name. I've edited the Hub post to detail which characters cannot be used in file names. Further, I listed some special names that cannot be used as note names, because they either cause problems or are forbidden as file names in Windows.

@Raymond, I suspect you have a corrupted Outlook data file. I've added a suggestion in the Hub to address this issue.


HDrum 5 years ago

This worked beautifully. Thanks so much for the clear, concise instructions. I DID have trouble getting the Visual Basic Editor to come up, but when I had my cursor over the middle of the screen and pressed ALT F4, it finally worked. Thanks again.


Tejas 5 years ago

I had colons (:) in the first line of the notes, and that created problem.. Once I fixed the notes. I'm stuck with the error that is mentioned by @Raymond. I tried changing the count from 1 to 2, but still no go. any other thoughts? I have about 700 notes :-)


Emperor Crusher profile image

Emperor Crusher 5 years ago from Wichita, KS, USA Author

@Tejas, I suggest you do the same thing I suggested for Raymond. And anyone else with the same problem, I also suggest this for you (IE. please try this before posting a comment of a failure). It may be a corrupted data file. From my hub: "There are many Hub pages that address how to fix the problem. Simply search for "scanpst" and follow he directions listed in the page." Let's see if that fixes your problem.


Nick Lockhart 4 years ago

Hi & thanks for your great instructions. When trying to perform the 'run' I received the error message:

"The Macros on this project are disabled. Please refer to the online help or documentation of the host application to determine how to enable macros." How do I rectify that so I can do the export please? Thanks, Nick


Emperor Crusher 4 years ago

@Nick, I just did a Google search of your error message and came up with a lot of results on how to enable macros, especially from Microsoft. I suggest you follow some of these directions that are specific to the version of Office that you are using.


Nick Lockhart 4 years ago

Thanks but now I get a Compile Error :(


Emperor Crusher profile image

Emperor Crusher 4 years ago from Wichita, KS, USA Author

@Nick,I'm sorry for your troubles. It seems you have some problems that are outside the scope of this hub. Since this is just a comment section, at this time it might be best to hire a technician or find a forum to post your problem and work through a solution.


Marco 4 years ago

Good work!

Before the line myNotes.Items... I insertet these lines:

noteName = Replace(noteName, ":", "-")

noteName = Replace(noteName, "?", "-")

noteName = Replace(noteName, "*", "-")

noteName = Replace(noteName, Chr(34), "-")

This makes, that unallowed characters in the filename are translated into "-".


Summitville 4 years ago

I have one note that is greater than 30,000 characters (30,168 bytes) and it would not open in Outlook. But the NOTE did open and it did SAVE as TEXT file with the VB6 script!

Also, I had error ...

-2147467259 (80004005) is invalid character error.

which is same error as previous user reported.

So, I added ...

notename = Replace(notename, Chr(9), "-")

to removed the invisible TAB Character from Subject.

Error was eliminated.


Paul Lauener 4 years ago

Thank you so much!! I've been looking for a way of doing this for literally years. I've finally managed to abandon the tyranny and time wasting of Outlook and Outlook exchange!!!! If anyone wants to export all their e-mails, the best I have found of doing it is to set up your Gmail in Outlook and then copy and paste all your folders from your Exchange account to your Gmail account. It is time consuming but it all gets there with correct dates etc.


pecoraio 4 years ago

Thanks, This worked perfectly. This has been on my to do list for a while.


Thanks Marco 4 years ago

Marco - it was getting through only about 33 of my 200 total, then started failing for m. UNTIL I made your additions - THANK YOU! You should change your name from Marco to Macro :)


Mr. Slow 4 years ago

You ROCK THE HOUSE!! This is the best thing that ever happened to me!


Mark 4 years ago

Thank you so much for helping this ignorant slob! It worked like a charm. I have no idea how or why but it worked great!


Toni Azon 4 years ago

Thanks a lot . It worked fantastic ¡

Champion man ¡


Henk 4 years ago

I love everything about this!


Aaron 4 years ago

I'm getting a compile error at Set myNote expected end of statement?


Mili Zhang profile image

Mili Zhang 4 years ago from Shanghai, China

Brilliant!! Thanks!!


Nikolas Hill profile image

Nikolas Hill 4 years ago from Baltimore, Maryland

This worked wonderfully! I got a Nokia Lumia 900 this week, and thought I might have made a mistake changing from my BB Pearl!! That thing was 4 years old!! Anyways, I exported my Notes as .txt files and can now edit them with OneNote. I probably won't need to use Outlook Notes anymore, I really just did on my BB. My HP Pocket PC used to have .doc and .txt files. Thanks a billion though, great solution!


cof1971 4 years ago

Thanks for this - works a treat, and like so many others I've been looking for a way to export / backup Outlook Notes.

One step further, have you figured out a way to import the .rtf or .txt back into Outlook Notes. I had to re-create my .pst and other than creating all of the Notes again copying & pasting one by one from the .rtf into a new Note..... A tedious job if you have a load of Notes :-)


raspoid 4 years ago

I get a "Run-time error 13: Type mismatch" error when i try to run this.

I have notes which have plenty of numbers and special characters in the body but not in the name. Could this be the reason that I can't get this to work?


Emperor Crusher profile image

Emperor Crusher 4 years ago from Wichita, KS, USA Author

@raspoid, I would not think special characters in body of the note would matter, except in the first line. Remember that notes are named from the first line in the note. I hope this helps.


Jim M 4 years ago

After I copy the code (starting with "Sub" and ending with "End Sub"), I get a compile error. Then , after I click on "Run Sub Userform", instead of a pop-up asking me to select a sub-folder, I get a pop-up entitled "macros" asking for a "Macro Name". Please help!


Emperor Crusher profile image

Emperor Crusher 4 years ago from Wichita, KS, USA Author

@Jim M, the only thing I can think of is that you did not copy the code properly. It sounds like you are doing the copy right, but if the code is not correct, then after it is entered it can give a compile error.


Jim M 4 years ago

You were correct again. For some reason, I couldn't copy directly from this site to the Window Pane, but I was able to copy from this site to a word file and then from the word file to the Window Pane. It then worked as advertised!

I've been trying to get my Outlook Notes onto my iPhone for over a year. With this solution, I got my notes stored as text files on my PC. I then used the free versions of DiskAid for my PC and FileApp for my iPhone to transfer the Text Files onto FileApp on the iPhone.

Thanks a million!


Emperor Crusher profile image

Emperor Crusher 4 years ago from Wichita, KS, USA Author

@Jim M, when I have used iTunes for my clients in the past, there was an option to sync Outlook notes to the iPhone. If you just want the current notes on there, this will work fine. But if you make changes to either side and want them synchronized (like I do on my Android), then iTunes may be your answer. I also author syncdroid.net, where I list software that syncs Outlook to Android devices. These kind of things are up my alley.


Chittu 4 years ago

Open Outlook + Notes

Then Copy Notes or Select all and Copy & Paste


Emperor Crusher profile image

Emperor Crusher 4 years ago from Wichita, KS, USA Author

@chittu, thanks for sharing. That works very well if you have just a few notes. You copy the text and then paste it into something like Word or Notepad and then save the file. But my way saves time if you have more than 5 or 6 notes. Some people have hundreds.


Richard Pytel 4 years ago

Got stuck when after clicking run and run sub a box popped up asking for the name of the macro


Wilfredo 4 years ago

Simple, ans very usefull THX..


Wilfredo 4 years ago

Richard you need to set permitions for macro on TrustCenter then restart outlook and try again.


Bernard 4 years ago

Great!

And gives so many ideas...


Anonymous 3 years ago

This was really awesome!! Thanks!


Glenn Frazier 3 years ago

Really works! Pay attention to the title of each note (first line of note) because that becomes the file name of the text file. You really do need to remove any special characters in the Note title (not the body of the Notes).

I moved Outlook 2010 notes to OneNote 2010. I used the procedure above for step one. Step two I used OneNote 2010 Text File Importer. See http://blogs.msdn.com/b/johnguin/archive/2010/06/2... It's a little flaky but eventually got it to work.


Emperor Crusher profile image

Emperor Crusher 3 years ago from Wichita, KS, USA Author

Glenn, that's a great tip! I think Microsoft wants everyone to move from Outlook notes to OneNote.


yes! 3 years ago

OMG THXXX!!!!


Harsha 3 years ago

THANK YOU!!! A few tweaks with the note titles and this worked magic. :)


Khalid 3 years ago

what is "the root of the C: drive"?

I just open drive C , and create the folder there. Is that right?


Emperor Crusher 3 years ago

Khalid, that is correct.


JoeB 2 years ago

Thanks a million for that it worked perfect.


You.Are.Awesome! 2 years ago

OMG....thanks a TONN mann!!

I was trying to figure out a way to do this....thank God i came across ur page!

Thanks a million!!! :D


Vaibhav 2 years ago

This is really really really helpful :) Thanks!


Petrik Lajos 2 years ago

Sorry, both of them does not work for me. I had used ScanPST.

It crashes after few files.

Maybe because of codeset? I use hungarian and russian letters too.


Petrik Lajos 2 years ago

So, for me the solution was the changing of the 4. line to this one:

noteName = Left(Replace(Replace(Replace(Replace(myNote.Items(cnt).Subject, "/", ""), "\", ""), ":", ""), """", ""), 40)

And I use RTF variant, because of russian characters. If TXT, it must be UTF-8 encoding, but I don't know, how to set it. :) My knowledge is only PHP, Java, etc.


mainmeat 2 years ago

SPOTON!!!!!


brajesh 2 years ago

I used this macros successfully three months back. However, when I wanted to update it today. The macros does not run. The remark says " Macros in this project disabled". Request help.


Emperor Crusher profile image

Emperor Crusher 2 years ago from Wichita, KS, USA Author

Brajesh, I think you probably have macros disabled in Outlook. Try this. Select File, Options, Trust Center, Trust Center Settings, Macro Settings, Notification for All Macros, OK. Then try it again.


Linda Breshears 2 years ago

awesome! It took some effort but it worked. Yay


John G 2 years ago

Is there a way to import notes via a similar method?


John E 2 years ago

Oldie but still a goodie. Worked great for me. Had some special characters in Note names to fix but after that all worked great. Thanks.


Phil R 21 months ago

This worked fine for me with Outlook and Office 365

Thank you very much Emperor!


Alex 16 months ago

For anyone having problems with the code like I did (it was giving me an error message that said "run-time error '-2147467259 (80004005)': The operation failed.", I found an alternate write-up of the code listed by EmperorCrusher.

This is the alternate that worked for me:

Sub exportNotes()

myfolder = "c:\notes\"

Set myNote = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderNotes)

For ibi = 1 To myNote.Items.Count

fname = Replace(Replace(Replace(myNote.Items(ibi).CreationTime, "/", ""), " ", ""), ":", "")

myNote.Items(ibi).SaveAs myfolder & fname & ".txt", 0

Next

End Sub

Hope that helps...(and hopefully someone more tech-oriented than me, like EmperorCrusher, can maybe analyze the differences in the code and tell us why the error went away with the modified version). Thanks for the awesome post by the way!


Emperor Crusher profile image

Emperor Crusher 16 months ago from Wichita, KS, USA Author

Alex, the code you found varies in a few ways, but only one thing is pertinent. I use the note Subject as the saved note file name and replace some characters in the subject name that are considered illegal by the Windows file system (“/” and “\” characters with a “-“). Your code uses the Creation Time of the note as the file name and removes the “/”, space, and “:” characters.

It is my preference to know the name of the note by subject when I look through the folder containing the saved note files. However, the subject can have many illegal characters in it that need to be replaced. Using the Creation Time for the file name always has a consistent result and therefore you always know which characters need to be removed to create a valid file name. Your file name will always look something like 12182008122937PM because the file was created on 12/18/2008 at 12:29:37 PM.

Less importantly, the code you found also mandates that the notes are located in the main Notes folder. This makes the process of exporting easier, but less flexible. My code allows you to choose which Notes folder you wish to export in case you have multiple Outlook data files and you wish to choose which one you desire to export.

Your error with my code probably resulted from the note Subject having illegal characters that were not being removed.


Emperor Crusher profile image

Emperor Crusher 16 months ago from Wichita, KS, USA Author

I have updated this hub to include new code to strip every non-alphanumeric character from note names during the export process. I look forward to comments on how this is working.


Alex 16 months ago

Thanks, kind sir! I prefer the file name to be more specific also, of course, rather than being a string of digits representing date and time of creation, but unfortunately the original code kept giving me a run time error (I guess my notes were full of illegal operators).

Anyways, if that was the cause of my errors, then I'm sure your updated code will now work for me, and for others on here (who probably had the same or similar errors). I'll try it out myself next time I sink my iPhone notes to Outlook!

Thanks again for the very helpful write-up.


Alex 16 months ago

*sync


Emperor Crusher profile image

Emperor Crusher 16 months ago from Wichita, KS, USA Author

Alex, Thank you for the kind words. I should acknowledge that I took a part of the code you presented and included it in my own. It allows users to more easily change the path of the folder where the notes are placed.


Derek C johnstone 16 months ago

Hi

Brilliant work.

I use Notes in Outlook to store all my user names and password clues on over 200 sites, but needed to make that available on my tablet. I've changed to a Cloud approach with your great help.

Can I send you a donation? Perhaps paypal?


Emperor Crusher profile image

Emperor Crusher 16 months ago from Wichita, KS, USA Author

If anyone does wish to donate, you may go to to the following to make a donation through paypal. If this is against Hubpages policy, I'd be glad to remove this comment, but I am just answering a question. ;-)

icthustechnology.com/pay-online


Ant Smith 6 months ago

Brilliant.

I did a search. Tried synchio and got a very comprehensice xml file, but all i wanted is a word doc for each note so that was just too convoluted.

This solution 100% met my particular user story - many thanks

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working