

The above steps are better than manually typing all the boilerplate, but it's still quite a bit of manual effort. Instead, I copy the code into Notepad++, perform a few find and replace functions, then copy it back into the VBE. Performing such a transformation manually would be tedious and error-prone. S = s & " Debug.Print ""Default: "" tbText0" & vbNewLineĮnd Sub Improving the process with Notepad++ S = s & " Debug.Print ""Dot: "" Me.tbText0" & vbNewLine S = s & " Debug.Print ""Bang: "" Me!tbText0" & vbNewLine S = s & "Private Sub Command2_Click()" & vbNewLine S = s & "Option Compare Database" & vbNewLine How do we transform the above code into the routine below? 'Build multi-line VBA string In yesterday's article about copying and pasting code, I promised to reveal the Notepad++ trick I use for turning an existing block of code into a string that can be printed to the immediate window or saved directly into a code module.įor example, let's use this code from a recent article on the difference between the bang ( !) and dot (.
