![]() |
|
#1
|
|||
|
|||
|
Hi! I use this macro to delete an ending period at the end of a single paragraph.
Is there a way to delete the period without having to re-insert the paragraph mark? Thanks! Code:
Sub DeleteEndingFullStop()
Dim para As Paragraph
Dim txt As String
Set para = Selection.Paragraphs(1)
txt = para.Range.Text
' Check if paragraph ends with a period before the paragraph mark
' check the character before vbCr (ASCII 13)
If Len(txt) > 1 Then
If Mid$(txt, Len(txt) - 1, 1) = "." Then
' Remove the ending period
para.Range.Text = Left$(txt, Len(txt) - 2) & vbCr
End If
End If
End Sub
Last edited by macropod; Yesterday at 01:50 PM. Reason: Correct code tag usage |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Macro to delete table rows based on the absence of a single specific keyword
|
JellehFishh | Word VBA | 2 | 06-27-2019 08:23 AM |
| Highlighting applied to range ending in a paragraph continues to apply to text added after | Peterson | Word VBA | 2 | 10-08-2018 02:50 PM |
| Delete starting and ending character of a line | Ktulu | Word VBA | 2 | 04-26-2018 09:59 AM |
how do you formulate the date by pay period ending?
|
crussell | Excel | 8 | 02-23-2016 07:38 AM |
| Paragraph ending in following page | tadlomc | Word | 1 | 01-18-2012 05:31 AM |