查找单词方程和每一个保存退出作为单独的文件(Find equations in word and s

2019-10-21 01:16发布

我想经过一个Word文档,使用VBA,每次取式,将其保存到剪贴板中,打开一个新的空白文档,并进行保存为PDF文件。

我发现了两段代码,这应有助于我上手但也走得很远:

Sub get_eqns()
    Dim eqns As OMath
    Dim para As Paragraph

    For Each eqns In ActiveDocument.OMaths
        With eqns.Range.Select
            '
            '~~> Rest of the code
            '
        End With
    Next

    For Each para In ActiveDocument.Paragraphs
        If para.Range.OMaths(1) = True Then
            para.Range.OMaths(1).Range.Select
            With Selection
                .CopyAsPicture
            End With
        End If
    Next
End Sub

Answer 1:

我找到了解决办法,并希望分享:

Sub get_eqns()

Dim i As Integer
For i = 1 To OMaths.Count
    'your code here

    OMaths.Item(i).Range.Select
    Selection.Copy

       'Do other code here to open new doc, etc

    Selection.Paste
Next i
End Sub

我有代码的其他部分,坚持己见的人正在经历的Word文档。

谢谢。



文章来源: Find equations in word and save each out as separate file