我有一个文档,以分节符分隔。 在每个部分中,我可能有零个或一个分栏符。 我想从一个包含两列,像这样每个部分的第一列中提取文本:使用VBA从Word中的特定列中选择文本
For Each oSec In ActiveDocument.Sections
iSectionStart = oSec.Range.Start
iSectionEnd = oSec.Range.End
i = oSec.PageSetup.TextColumns.Count
If (2 = i) Then
' Update the range to only contain the text in textcolumn 1
' then select and copy it to a destination string
End If
Next oSec
然而,TextColumns对象似乎不具备返回列内容的方法。
少很多琐碎的比我预期的! – pnswdv
但是,我不需要担心您描述的列中断歧义。在草稿模式下查看时,源文档保证格式为Language1 + ColumnBreak + Language2 + SectionBreak。 – pnswdv