In a previous post we wrote a ‘SpecialPaste’ macro to paste content from the clipboard into a numbered questionnaire and select and indent the content after it is pasted:

This macro indents the pasted content just once, to align with the number of the question. But I may want to align the content with the text of the question like this:

To do this manually I would just click the indent button twice. I would do a similar thing in the macro:

Selection.Paragraphs.Indent
Selection.Paragraphs.Indent

Here is the new macro:

But I don’t always want to indent twice. Sometimes I want to indent once and sometimes not at all.
We could write 3 different macros with a different indent applied in each one. Or we could go into the code and turn ‘Indent’ lines off and on as we need.
To do this we use the same technique we use to create a comment. A single quote in front of a line of code turns it into a comment and therefore ‘Off’ as code.
Here is our macro with one of the lines turned off:

The first ‘Indent’ line of code is now green because we have turned it into a comment. To turn it back on we simply remove the single quote from the beginning of the line.

Similarly we could turn off the line of code that inserts a paragraph:

We can add or apply additional formatting to the macro, such as setting it to bold:

And turn it ‘off’ when we don’t want to use it:

In future posts we will make use of this technique for when sharing code samples with optional code that you can use by removing the single quote.