Find equations in word and save each out as separate file

。_饼干妹妹 提交于 2019-12-11 08:34:48

问题


I would like to go through a Word doc, using vba, to take each equation, save it to the clipboard, open a new blank doc, and save that out as a pdf file.

I found two pieces of code which should help me get started but neither get very far:

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

回答1:


I found the solution and wanted to share:

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

I have code for the other parts, the stickler was going through the word doc.

Thanks.



来源:https://stackoverflow.com/questions/26043173/find-equations-in-word-and-save-each-out-as-separate-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!