View Single Post
 
Old 07-31-2021, 09:15 PM
jec1 jec1 is offline Windows 7 32bit Office 2013
Advanced Beginner
 
Join Date: Jan 2012
Posts: 84
jec1 is on a distinguished road
Default Trim trailing space macro stopped working

Hi everyone

Resolved.

This is an old macro that just removes the trailing space for text (quick clean up). But it is not working Windows 10 Office 365 Business Standard.

A
Rny ideas how to make it work? - It doesn't error it just doesn't remove the trailing space in the Word document.

Sub Purge_Trailing_Space()
Dim s As String
On Error Resume Next

With ActiveDocument
If Len(.Range) = 1 Then Exit Sub
s = .Characters.Last.Previous
While s = " " Or s = Chr(13) Or s = Chr(11)
.Characters.Last.Previous = ""
s = .Characters.Last.Previous
Wend
End With

End Sub

Janine

Last edited by jec1; 08-01-2021 at 03:15 PM.
Reply With Quote