View Single Post
  #26   Report Post  
Posted to microsoft.public.word.tables
David Turner David Turner is offline
external usenet poster
 
Posts: 1
Default Search & Replace



"Graham Mayor" wrote:

Good thinking - that would equate to

Dim oRng As Range
Dim oTable As Table
Dim acell As Cell
For Each oTable In ActiveDocument.Tables
With oTable
For Each acell In oTable.Range.Cells
Set oRng = acell.Range
oRng.End = oRng.End - 1
oRng.Text = RTrim(oRng.Text)
Next acell
End With
Next oTable

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Might be best to first check whether there is actually a space before the
end of cell marker to avoid unnecessary trimming.

Sub RemSpaceBeforeCellMarker()

Dim oRng As Range
Dim oTable As Table
Dim acell As Cell
For Each oTable In ActiveDocument.Tables
With oTable
For Each acell In oTable.Range.Cells
Set oRng = acell.Range
oRng.End = oRng.End - 1
If Right(oRng.Text, 1) = " " Then
oRng.Text = RTrim(oRng.Text)
End If
Next acell
End With
Next oTable

End Sub