ProblemYou want to double-space a string comprised of multiple lines of text separated by newlines. SolutionUse the String object's Replace() method to replace all vbNewLines with two vbNewLines. DiscussionThe Replace() method provides an easy solution to this problem. Simply replace each occurrence of a vbNewLine separating the lines of text with a double vbNewLine: content = content.Replace(vbNewLine, vbNewLine & vbNewLine) Figures 5-20 and 5-21 show a multiline example string before and after this replacement. Figure 5-20. A string comprised of five lines of single-spaced textFigure 5-21. The same string, double spacedSee AlsoRecipe 5.16 shows how to replace specific substrings within a larger string. |