我的目标是使用VBA宏将Word中的多行格式化文本复制到Excel工作表中。
现在我有一个需要两个单元格的多行文字。
这是我目前的代码:
With oWB.Worksheets("EPICS")
' Insert DESCRIPTION - todo
'
' HEADING xyz is selected, move one down and go to Pos1
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine
' Save current line number (BEGIN)
BeginText = Selection.Range.Information(wdFirstCharacterLineNumber)
' Go to the first table and one move up
Selection.GoTo What:=wdGoToTable, Which:=wdGoToNext, Count:=1, Name:=""
Selection.MoveUp Unit:=wdLine, Count:=1
' Save current line number (END)
EndText = Selection.Range.Information(wdFirstCharacterLineNumber)
RangeToSelect = EndText - BeginText
Selection.MoveUp Unit:=wdLine, Count:=RangeToSelect, Extend:=wdExtend
Selection.Copy
.Cells(1, 1).PasteSpecial xlPasteValues
End With
我有什么想法可以处理这个或任何输入?
答案 0 :(得分:1)
...
Selection.Copy
.Cells(1, 1).PasteSpecial xlPasteValues
...
.Cells(1, 1).Value=Selection.text