问题
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