Embed Code Snippets into Microsoft Word with Notepad++

Last updated on October 10th, 2023 at 09:09 am


Writing good documentation for technical processes is a critical function that even coders can't avoid. And since Microsoft Word is the standard for documents, it's inevitable you'll need to at least drop the occasional code snippet into a Word document at some point.

Code on computer screen programming software

This post may contain affiliate links. We may earn a commission if you purchase an item through our links. It costs you nothing and helps us to fund this blog. Please see our Affiliate Disclosure & Notification for details.

Why Notepad++ as an option? Well, Microsoft Word isn’t exactly the first program one might think of when it comes to writing code. While Word can do a lot of things, code editing isn’t what it’s designed for. Nevertheless, writing good documentation for technical processes is a critical function that even coders can’t avoid. And since Microsoft Word is the standard for documents, it’s inevitable you’ll need to at least drop the occasional code snippet into a Word document at some point.

But dropping code into MS Word sucks.

If you’ve made it this far, it’s safe to say you got here looking for a clean way to get your code snips and scripts into a Microsoft Word document. You’d probably even want to retain syntax highlighting right? So let’s get into it…

Using Notepad++

The key to displaying code that looks good starts with the editor you use to write the code. Notepad++ is a great source code editor that supposed syntax highlighting for dozens of languages.

If you write code and scripts, you probably already know Notepad++ but if not, you can get it here.

Once it’s installed, type in your code, pick the language and all the syntax will be highlighted appropriately.

notepad++ SQL sript
A sample piece of SQL query script auto-highlighted in Notepad++

Notepad++ comes in both 32-bit and 64-bit flavors. I happen to prefer the 64-bit version, but there’s a catch…

Installing the NppExport Plugin

Notepad++ supports a ton of different plugins that give added functionality. You can use the help menu to be taken to Notepad++ Plugin Central but unfortunately, only the 32-bit version of NPPExport is available there.

If you installed the 64-bit version of Notepad++, you’ll need to head over to Github to snag the 64-bit version.

All you need to do is copy the NppExport.dll file from the download and drop it into your Notepad++ plugin directory. Unless you customized your install, it’ll be located at C:\Program Files\Notepad++\plugins.

The next time you open Notepad++, the plugin will be available.

Copying Text and Syntax Highlighting

Now that all the tools are in place, all you need to do is highlight the section of code you want to copy. Right-click the selection and then mouse-over Plugin Commands from the context menu. In the submenu, click Copy Text with Syntax Highlighting.

Notepad++ copy text with syntax highlighting nppexport plugin
The selection will be copied exactly as you see it.

Once that’s it, you just paste into Microsoft Word like you normally would and voila! All of your code with its pretty syntax is laid out in your Word document.

Conclusion

Folks in the technology industry spend a good amount of their time writing documentation. With the help of Notepad++ and the NppExport plugin, you can use the industry standard documentation software without sacrificing the syntax of your code snippets.

Sharif Jameel is a business owner, IT professional, runner, & musician. His professional certifications include CASP, Sec+, Net+, MCSA, & ITIL and others. He’s also the guitar player for the Baltimore-based cover bands, Liquifaction and Minority Report.

1 thought on “Embed Code Snippets into Microsoft Word with Notepad++”

  1. Pingback: Moving wp-config.php to a Non-Public Folder - Why & How

Leave a Comment

Your email address will not be published. Required fields are marked *


Subscribe to Our Mailing List

If you found the information in this post helpful, we'd love to have you join our mailing list. We promise we won't spam you, we only send out emails once a month or less.


You May Also Like:

This site requires the use of cookies to ensure you get the best experience.

Scroll to Top