Skip to content

Notepad++ macros, a basic example

This post is part 2 of 5 in the series Efficient work using Notepad++

Notepad++ macrosMacros have become one of my favorite features in Notepad++. It is possible to record actions and play them back one or more times. You can save a lot of time not having to manually repeat the same process over and over. I always have Notepad++ open, so it is fast and easy to get the result I want in just a few seconds.

Notepad++ macros

This animation will show you how to use macros. You can find detailed descriptions and step-by-step instructions with pictures below.
Notepad++ Macros Animation

In short, click on Start Recording, do whichever actions are needed, click on Stop Recording and Playback the macro one or more times. In this example I want to transform an ordered list of names into a comma-separated list I can use in a T-SQL IN operator. It would not take a lot of time to rewrite this particular list manually, but it takes a fraction of the time using macros, and the more data you work with the more time you save.

Keep in mind that the actions will be played back exactly as they are recorded, so use CTRL to work on words rather than characters. Use CTRL+arrows to move the caret to the previous or next word. Use CTRL+SHIFT+arrows to mark words if you need to copy them. Use CTRL+BACKSPACE or CTRL+DELETE to delete entire words at once instead of using BACKSPACE or DELETE multiple times. Use HOME and END to move the caret to the start or end of a line. It is also a good idea to disable Word Wrap if you’re working on multiple lines.

Notepad++ macros 1
1. Place the caret at the start of line 1. Click Start Recording (use either the button on the toolbar or through the menu MacroStart Recording).

Notepad++ macros 2
2. In this picture the following actions have been done and recorded:
– CTRL+DELETE deleted the number 1
– CTRL+DELETE deleted the dot and spaces
– Single quote added
– END moved the caret to the end of the line
– Single quote and comma added
– DELETE deleted the line break and moved the next line up to the end of the current line
Click Stop Recording (use either the button on the toolbar or through the menu MacroStop Recording).

Notepad++ macros 3
3. Click Playback (use either the button on the toolbar or through the menu MacroPlayback) to replay the recorded macro once, as shown in this picture.

Notepad++ macros 4
4. Click Run a Macro Multiple Times (use either the button on the toolbar or through the menu MacroRun a Macro Multiple Times) to replay the recorded macro as many times as you specify or until the end of file, as shown in this picture.

Notepad++ macros 5
5. Delete the last comma and the list is ready to be pasted into a T-SQL IN operator. In this picture Word Wrap has been enabled again.

Who is Cathrine Wilhelmsen?

Cathrine is a Microsoft Data Platform MVP, BimlHero, Microsoft Certified Solutions Expert, author, speaker, blogger and chronic volunteer who loves teaching and sharing knowledge. She works as a Senior Business Intelligence Consultant in Inmeta, focusing on Azure and the Microsoft Data Platform. She loves sci-fi, chocolate, coffee, craft beers, ciders, cat gifs and smilies :)


Hi! This is Cathrine. Thank you so much for visiting my blog. I'd love to hear your thoughts, but please keep in mind that I'm not technical support for any products mentioned in this post :) Off-topic questions, comments and discussions may be moderated. Thanks!

Click to Show / Hide Comments