我在 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
将显示一个“列”消息框。如何在显示消息框时删除换行符和点。