View Single Post
 
Old 11-09-2023, 04:34 AM
laith93 laith93 is offline Windows 10 Office 2019
Competent Performer
 
Join Date: Jul 2021
Posts: 117
laith93 is on a distinguished road
Lightbulb Find and replace paragraph mark on selected text and replace it with space in PowerPoint VBA

Hi,
I always copy from pdf files or webpage and appear as the follows:
46.png
All these lines belong to a single paragraph, so how to replace the paragraph mark on selected text inside textbox with space, I want to apply to selected text to prevent its effect on previously oragnized paragraph in the same text box.
I applied this code, but doesn't make sense
Code:
Sub findandreplacetext()
Dim sld As Slide
Set sld = ActivePresentation.Slides(1)
Dim shp As Shape
For Each shp In sld.Shapes
If shp.HasTextFrame Then
    If shp.TextFrame.HasText Then
        shp.TextFrame.TextRange.Text = Replace(shp.TextFrame.TextRange.Text, "vbCrLf", " ")
    End If
End If
Next shp
End Sub
I don't know what is the problem with this code, I replaced vbCrLf to char(13), but also nothing.
Any suggestion please
Thanks
Reply With Quote