【发布时间】:2021-06-17 15:04:44
【问题描述】:
我在 Word 中有一个表格。 Word table cell 我需要从单元格中提取(使用 Excel VBA)BOLD 文本到 excel 列,然后将以下文本(不是 BOLD)提取到下一个 BOLD 文本到下一个 Excel 列 Something like this 等等。 我尝试了以下操作,但它选择了整个单元格,而不是我需要的部分文本。 非常感谢任何帮助。
For Each wdCell In oDoc.Tables(1).Range.Cells
Set myRange = wdCell.Range
If nCol = 12 Then
With myRange.Find
.Text = ""
.MatchCase = False
.Replacement.Text = ""
.Forward = True
.wrap = wdFindContinue
.Format = True
.MatchWildcards = False
.Font.Bold = True
Do While .Execute
If myRange.Find.Found Then
Debug.Print "Bold text is found ->" & myRange.Text
myRange.Select
myRange.Start = myRange.End + 1
myRange.End = wdCell.Range.End
myRange.Select
ActiveSheet.Cells(nRow, nCol) = WorksheetFunction.Clean(wdCell.Range.Text)
Loop
End With
Next
【问题讨论】:
标签: excel vba ms-word word-table