How to trim table cell values in MS Word with VBA
问题 I have a table in a Word file. This vba program below will iterate through all the table cells Dim strCellText As String Dim uResp As String Dim Row As Integer Dim Col As Integer Dim itable As Table For Each itable In ThisDocument.Tables uResp = "" For Row = 1 To itable.Rows.Count For Col = 1 To itable.Columns.Count strCellText = itable.Cell(Row, Col).Range.Text uResp = uResp & Trim(strCellText) Next Next MsgBox uResp Next In the line uResp = uResp & Trim(strCellText) VBA appends a newline