我有一个很大的MS Word 2010文档,其中包含“框架”中的数据,至少我是这么认为的。这是一个截图:

我试着这样访问它:
Sub test()
Dim s As Shape
Dim i As Integer
Dim str As String
For Each s In ActiveDocument.Shapes
i = i + 1
If s.TextFrame.HasText Then
Application.StatusBar = i
End If
Next s
MsgBox ("done")
End Sub但这并不能让我成功。我需要遍历所有这些“框架”,但同样,我甚至不确定它是什么,并将其转储到Excel。有什么建议吗?我可以提取xml并对其进行解析,但似乎有点过头了。(+我还不太擅长解析)。
发布于 2015-01-10 17:08:49
我有来自甲骨文报告框架的*.rtf文件。试试我的宏。
Sub test()
Dim TabHourFrames() As Variant
numb_frames = ActiveDocument.Frames.Count
ReDim TabHourFrames(1 To numb_frames)
counter = numb_frames
For i = 1 To counter
Set myRange = ActiveDocument.Frames.Item(i).Range
t = myRange.Text
TabHourFrames(i) = t
Next i
Documents.Add DocumentType:=wdNewBlankDocument
For q = 1 To counter
last_par = ActiveDocument.Paragraphs.Count
Set rngLastParagraph = ActiveDocument.Paragraphs(last_par).Range
With rngLastParagraph
.InsertAfter Text:=TabHourFrames(q)
.InsertParagraphAfter
End With
Next q
ActiveDocument.Range(0, 0).Select
End Subhttps://stackoverflow.com/questions/27496243
复制相似问题