1

I am exporting data from MS Access to MS PowerPoint, and a part of the data is text fields (long) with multiple paragraphs, as in hitting ENTER between the lines in a single field. This results, after the export in a variety of phenomena which I'd like to clear. One of the most disturbing is control and special characters appearing in the Powerpoint slides.

I mainly tries using :search and replace" methods like

shp.TextFrame.TextRange.Text = Replace(shp.TextFrame.TextRange.Text, "this", "that")

but I have no idea how to solve the double blank line issues. Moreover, there seems to be an entire set of newline characters and combinations (see This SO question), and I have no idea which ones are there. In MS Word it's relatively easier, since its search and replace functionality supports these special characters. Not so in Powerpoint.

Thanks

Community
  • 1
  • 1
Gabe
  • 630
  • 1
  • 9
  • 25

1 Answers1

2

Try this macro to remove multiple blank lines

Function removeMultiBlank(s As String) As String
    With CreateObject("VBScript.RegExp")
        .Global = True
        .MultiLine = True
        .IgnoreCase = True
        .Pattern = "^\s"

        removeMultiBlank= .Replace(s, "")
    End With
End Function

Use it like

With shp.TextFrame.TextRange
    .Text = removeMultiBlank(.Text)
End With
A.S.H
  • 29,101
  • 5
  • 23
  • 50
  • 2
    @Jbjstam Yes, it will. OP shouldn't use it on formatted text. Useful for text imported from Access. – A.S.H Apr 20 '17 at 08:16