我有一个Word文件中的表格。 以下这段vba程序将遍历所有单元格。
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
在代码行
uResp = uResp & Trim(strCellText)
中,VBA会在每个单元格后面添加一个换行符和一个点。因此,MsgBox uResp
将显示一个“列”消息框。如何在显示消息框时删除换行符和点呢?