Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can you import a Microsoft Word Equation to Microsoft Excel using VBA?
    primarykey
    data
    text
    <p>I have been finding ways to move pictures and tables and other things from <code>Microsoft Word 2010</code> to <code>Microsoft Excel 2010</code>. What I would like to find a way to do would be to do the same thing with the <code>OMath</code> objects, or the Equations. I would like to keep the equations in their original form as much as possible, so if that means translating the <code>OMath</code> objects to a picture (<code>InlineShape</code>), then that is what I want to do.</p> <p>Here is what the equation looks like in Word, and I'd like to import that to excel using VBA: <img src="https://i.stack.imgur.com/bpjty.png" alt="enter image description here"></p> <p>Right now, I'm only able to transfer the Range.Text representation of this object, which makes this Equation look like this:</p> <p><img src="https://i.stack.imgur.com/0crtE.png" alt="enter image description here"></p> <p>I have found that I can select this object and do a selection copy. Is there a way to determine the dimensions of this selection? I'd like to paste this in a particular cell which is already resized to fit the equation. I loop through the paragraphs of the Word document, with each paragraphs referred to as <code>DocPara</code> and when I come across an equation, I select it like this:</p> <pre><code>DocPara.Range.OMaths(1).Range.Select With Selection .CopyAsPicture oWB.ActiveSheet.Paste Destination:=oWB.ActiveSheet.Cells(headingCount, 3) End With </code></pre> <p>The problem with what I have above is that the picture pastes where I want it, but is bigger than the row it is sitting on and if I resize the row, the picture stretches vertically linearly with the row resize. I need to resize the row I am pasting this image to before I paste. How can I access the size of the picture I just put on the clipboard?</p> <p>Does anyone have some ideas? I really appreciate it :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload