返回每个表格单元格的内容,并将文字指定给相应的数组元素
MoveEnd函数使用方法详解: 点击
参考文章: 链接
<pre name="code" class="vb">Sub ReturnCellContentsToArray()
Dim intCells As Integer
Dim celTable As Cell
Dim strCells() As String
Dim intCount As Integer
Dim rngText As Range
If ActiveDocument.Tables.Count >= 1 Then
With ActiveDocument.Tables(1).Range
intCells = .Cells.Count
ReDim strCells(intCells)
intCount = 1
For Each celTable In .Cells
Set rngText = celTable.Range
rngText.MoveEnd Unit:=wdCharacter, Count:=-1
strCells(intCount) = rngText
intCount = intCount + 1
If intCount = 4 Then
'替换文本
celTable.Range = "dd"
End If
Next celTable
End With
End If
End Sub
MoveEnd函数使用方法详解: 点击
参考文章: 链接