lkpederson
06-24-2014, 10:34 AM
Like the title says, my code is adding a hard return (line feed) at the end of each cell that it capitalizes the words. The hard returns are unwanted. I've tried moving the cursor back one character but that just moves the cursor back to next cell.
Ideas?
One item to note about the structure of the table: first row is all merged which is why I use .cell in lieu of column.
Sub CapitalizeSubmittalsInTable() Dim cRng As Range
Dim Chg As String
Dim n As Integer
n = ActiveDocument.Tables(2).Rows.Count
Selection.HomeKey Unit:=wdStory
For i = 4 To n
With ActiveDocument
Set cRng = .Range(Start:=.Tables(2).Cell(i, 3).Range.Start, _
End:=.Tables(2).Cell(i, 3).Range.End)
cRng.Select
cRng.Text = StrConv(cRng.Text, vbProperCase)
End With
Selection.MoveEnd Unit:=wdCharacter, Count:=1
Next i
End Sub
Ideas?
One item to note about the structure of the table: first row is all merged which is why I use .cell in lieu of column.
Sub CapitalizeSubmittalsInTable() Dim cRng As Range
Dim Chg As String
Dim n As Integer
n = ActiveDocument.Tables(2).Rows.Count
Selection.HomeKey Unit:=wdStory
For i = 4 To n
With ActiveDocument
Set cRng = .Range(Start:=.Tables(2).Cell(i, 3).Range.Start, _
End:=.Tables(2).Cell(i, 3).Range.End)
cRng.Select
cRng.Text = StrConv(cRng.Text, vbProperCase)
End With
Selection.MoveEnd Unit:=wdCharacter, Count:=1
Next i
End Sub