-
Solved: can't remove carriage return
I often copy and paste text into an email. Sometimes each line has a carriage return (CR) which terminates the line. How does the script look like that would delete all CRs in a selected paragraph of text?
In Word I use the following script. It does not work in Outlook.
[VBA]Sub DeleteCR()
With Selection
.Text = Replace(.Text, vbCr, " ")
End With
End Sub[/VBA]
In PowerPoint I use another script. That also doesn't work in Outlook.
[VBA]Sub DeleteCRs()
Dim oshp As Shape
Dim otxt As TextRange
'check for type of selection
'replaces all text in shape unless
'text is highlighted
If ActiveWindow.Selection.Type = ppSelectionNone _
Or ActiveWindow.Selection.Type = ppSelectionSlides Then Exit Sub
If ActiveWindow.Selection.Type = ppSelectionShapes Then
Set oshp = ActiveWindow.Selection.ShapeRange(1)
Set otxt = oshp.TextFrame.TextRange
End If
If ActiveWindow.Selection.Type = ppSelectionText Then
Set otxt = ActiveWindow.Selection.TextRange
If Len(otxt) < 1 Then
Set otxt = otxt.Parent.Parent.TextFrame.TextRange
End If
End If
With otxt
.Text = Replace(.Text, vbCr, " ")
End With
With otxt
.Text = Replace(.Text, ". ", ". " & vbCr)
End With
End Sub[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules