Sometimes we just want to keep writing, so a troublesome setting detail or simple character action shouldn’t slow us down unnecessarily. Enter novel notes. We can quickly insert a relevant note and move on with our writing or other editing.
Thanks for your interest
This content is part of a paid plan.
Quickly insert a simple novel note
In a writing sprint or a Pomodoro sequence, we often just want to keep writing or editing. A setting detail or simple character action shouldn’t slow us down unnecessarily. It's easy to stop and want to correct a detail, but sometimes our minds can freeze like stubborn neurological mules.
Enter novel notes.
I’ll often insert a quick note where I’m writing, so I can move on with the current task. A dialog detail might stump me. At other times I'm just not happy with the wording, so the note indicates the text needs some extra editing or setting or era-based revision. Research can be a tempting time sinkhole when not managed properly, so I may defer checking an historical fact about what the characters are doing or a tool they're using.
Novel note variations
The macro below allows us to quickly insert a standard (to your own workflow) note in a styled paragraph above the current one and move on with writing or editing. Other variations include:
- A sibling article inserts the note inline with the text (not my preferred approach).
- A member extension adds contextual information to the note based on the nearby content (excellent for specific research comments).
- Multiple note types will likely evolve as we work where each performs similar tasks just with different words or styles. At the cost of making it more technical, we can ease the repetition by implementing several functions.
Such novel notes have many variations based on your own workflow and preferences of placement, wording, context, or styles of the different note types; but these articles should get you started if you find the idea interesting.
Create the empty macro
A previous post covers creating an empty macro like the one shown below using the Word interface. The result will look something like:
The single quote tells VBA the rest of the text on that line is a comment meant for human readers. We start our macro steps on the empty line.
What is an object in VBA?
An "object" in VBA is an internal representation of some document element. Examples include a Paragraph or a Document, but other more generalized types exist such as a Range (see below). Objects include various actions (called "methods") and data (called "properties") that allow us to manipulate them or any associated document content.
What is the Selection?
The Selection is how VBA represents what we see and manipulate on the screen. Consistent with this notion, only one Selection exists per document. It can include selected content or just be an insertion point (i.e., the blinking I-bar waiting for text) since the latter is essentially an empty selection.
At a rudimentary level, a Selection consists of Start and End positions in a document indicating the spanned content, but it also includes many methods and properties that allow us to control its extent or position in the document, change various settings, and handle other details specific to its purpose in a document. A separate article goes into more detail about the Selection.
What is a Range?
A Range is an object corresponding to a general span of text in the document with defined Start and End positions. Practically speaking, we can treat one much like an invisible selection or insertion point. As an object data type, we can assign document ranges to a variable, and then we can move or change its extent using various methods or properties. We can further delete or modify the document text, format content, etc. See a separate article on our brief introduction to Ranges for more information about them.
What is a Paragraph?
A Paragraph is also a VBA object representation of the named document element. It is like a Range, but it spans specific document content usually bounded paragraph marks on both sides (or the beginning of the document). It also stores information related to paragraph formatting and other settings. We can create a Paragraph variable to refer to a specific document paragraph and manipulate the paragraph settings and properties.
Difference between a Paragraph and a Range
A Paragraph is also its own data type, but its properties and methods are more specific to describing paragraph related attributes. A Range works more with its content, position, or extent in the document. A small amount of overlap in properties or methods exist compared to its corresponding range. For example, we can set the Style property with either a Paragraph or a Range variable.
What are the manual steps?
What steps would we use to add a new novel note paragraph manually?
- Move to the end of the previous paragraph (mouse is slow)
- Tap Return to insert a new paragraph
- Type the note text (repetitive and boring)
- Change the note paragraph style (optional but repetitive, blehh)
- Move back to the original editing location (waste of time)
Of course, some variations are possible, but most will be about the same number of steps. A standard Word keyboard shortcut exists to move up a paragraph (Control+Up in Windows or Command+Up arrow on a Mac), so that helps a little, but the process still requires a lot of steps especially if we insert such notes often. The note style is optional, of course, but it helps differentiate notes from the novel text. We can also use different styles for different types of notes such as a note indicating awkward wording, a research related note, setting comments, etc.
We definitely can't call the steps above fast, but why not make it a keystroke and just keep working. Then we can relax about forgetting that detail when we return to the text in a later edit. When a note task is finished, a supporting macro makes deleting the note paragraph quick and painless, literally just tap Control+Shift+Delete in Word for Windows or Command+Shift+Delete on a Mac.
Insert a simple note in a new paragraph
Rather than just implement the manual steps above like a VBA automaton, we'll take advantage of more VBA-like thinking.
Use a Range variable
Generally speaking, the current macro is most useful if it just inserts the note without interrupting our workflow. More specifically, we want to avoid moving the insertion point or changing the initial selection, so we can just keep writing or editing.
We could just use the Selection for each step while making use of some VBA techniques to not disturb the initial position, but a logical quirk pops up that needs some extra explanation. Using a Range variable is probably the easiest and clearest way to insert the note without disturbing our workflow.
Store the note text
We can define the fixed note text as a plain “string” of characters. This is not necessary, but it helps make our macro easier to read and modify for other notes we might wish to create.
The note text needs to be in double quotes, so VBA knows it's plain text. We used an equals = sign to store the note text value in the variable. VBA automatically determines the variable's data type based on what we're storing in it.
Set the current paragraph Range
Given the intended note placement, it's convenient to create a working range based on the initial paragraph. We begin by referring to the Paragraphs collection of the Selection.
We want the first paragraph of the collection using its First property.
A Paragraph is its own data type in VBA which is related to but different from its Range. We want the range of the first paragraph, so we can use its text insertion methods. We get the first paragraph's range using its Range property.
Now we can assign this paragraph range to our range variable.
We must Set the Range since it contains more information than just a value like a number. This works even if the starting selection doesn’t include the whole paragraph or if the selection spans multiple paragraphs (following paragraphs are ignored).
This range variable is independent of the initial selection. We can manipulate it without directly changing the selection unless we use it to specifically delete or modify text in that region.
Insert the new paragraph
In the current macro, we're inserting the note into a separate paragraph to improve clarity. We add a new paragraph using the InsertParagraphBefore method.
The range automatically extends backward to include the new paragraph mark. A separate macro article inserts inline novel notes if you prefer that approach.
Insert the note text
Finally, insert the actual note text using the InsertBefore method.
The Text option is the only possibility for this command, so we can omit the name and just include the inserted text. We used the previously stored note text variable here. The MyParagraphRange automatically extends its Start position backward to span the newly added text.
Change the note paragraph style
Applying a different paragraph style will better distinguish the note from the novel text. Of course, the style needs to be available to the document or the current template (Normal.dot is the default global template).
Collapse the paragraph Range
Since MyParagraphRange now spans both the original and the newly added note paragraph, we use the Collapse method on the range. This command effectively "moves" the range position to the new paragraph, so the style added below only applies to the note paragraph.
The working range is now empty meaning it's Start and End positions are the same (counted based on the number of characters from the beginning of the document). The command collapses toward the start (left side) of the range by default which is what we want for this macro.
Set the new paragraph style
We set the paragraph style using the Style property of the Range.
We just used a literal style name as text and let VBA do all the work under the hood. This property is general enough that we could also assign a Style object that we've saved in a different variable or even a constant from a table of built-in styles, but we usually just need a valid style name.
The range is collapsed at this point in the macro, but a paragraph style will be applied to the included paragraph. Of course, use whatever note style name is relevant in your manuscripts.
Final simple novel note macro
Put the commands together to quickly insert a simple novel note into the document.
This one is simple, but it definitely helps me remember details for later editing while allowing me to move on with my writing in the moment. Defining the note text at the top of the macro allows me to easily change the text. I have several variants of this macro assigned to different keyboard shortcuts. Granted, we don't want to leave "everything" for the editing phase, but my rough priority in the first draft is to get the story on the page. Some details just have to wait.
Note variations
Two sibling articles extend this simple note to make it even more useful. One variation includes any selected text or the nearby word to insert a contextual note. I find this version particularly useful for research-oriented notes (e.g., a historical phrase I can't quite remember at the time or note to look up the name of a specific tool). See another article if you prefer your notes to be added inline with the novel text. Of course, many other possibilities exists with preferences based on the placement, wording, context, and/or style of the different notes; so these macros will probably just be a starting point for your own customizations.
Does the style exist?
The Scene Note (or your manuscript equivalent) style must be accessible in the document. Unfortunately, it will cause an error if it is not available, so just be sure the desired style is included in your work in progress.
Ideally we would check whether the style exists first before trying to apply it to a paragraph. Detecting whether a given style is valid is more complicated than it should be, so a separate article covers style validations. It is a little technical in a forced, awkward way; however, once it's included we can just add an extra conditional statement around the style assignment.
Improvements
In addition to implementing other note types, we could improve a few more things.
Screen updates
This macro makes multiple changes to the document, so it is a good candidate to disable screen updates while running. On the other hand, the simple changes are probably fast enough we would never notice the difference.
Undo record
Since this macro makes multiple small changes, it is a good candidate for undo records, but they are excluded from this version because they can cause problems if not properly implemented.
Function version
I have several flavors of notes with different text and note paragraph styles. It's a shame to copy the entire macros over and repeat everything, so these macros are begging to be reimplemented as functions.