PDA

View Full Version : Automating reports: Using Fields, Ranges, Smart Tags



nickthird
12-20-2013, 02:10 AM
I'm new to VBA, though I'm old to programming. I need to either automatically change the pictures in a word document to pictures from files (known location), or alternatively, insert pictures in the correct location (so that I have two pictures side by side in one page). I'm hoping this is possible with a command line argument and a macro.

The other thing I have nearly given up on is adding a couple of simple equations. Any method would do, including hex editing the document, as I couldn't find any documentation for this whatsoever. The equation is a = ... +/- ... that's it. The numbers are loaded from a file.

My last report was 35 pages long and I am desperate to find any method of making life easier as they seem to be getting only longer.

So far I got to the point of adding a picture from matlab to a doc but there is no documentation and I have no idea how to move it.

SamT
12-22-2013, 09:35 AM
Nick,

Welcome to VBA Express. I am sorry you haven't received any responses yet. I am a Moderator, not a Word smith, so I am only going to change the Title of the thread to try and attract more responses from Word experts.

Are the Formulas you want always in the same structural or logical location in the Document?
What/where is the file containing the numbers ?

Same Questions regarding the images?

macropod
12-22-2013, 06:06 PM
I'm new to VBA, though I'm old to programming. I need to either automatically change the pictures in a word document to pictures from files (known location), or alternatively, insert pictures in the correct location (so that I have two pictures side by side in one page). I'm hoping this is possible with a command line argument and a macro.
Word has no way of identifying the content of a picture to replace it with a different one. However, if you insert a picture via Insert|Picture with the Link option, you can then change the source picture and have the copy in Word update automatically.

As for automatically inserting pictures, see: http://www.vbaexpress.com/forum/showthread.php?44473-Insert-Multiple-Pictures-Into-Table-Word-With-Macro


The other thing I have nearly given up on is adding a couple of simple equations. Any method would do, including hex editing the document, as I couldn't find any documentation for this whatsoever. The equation is a = ... +/- ... that's it. The numbers are loaded from a file.
There isn't a built-in building block for this, so you have three options:
1. Create one then use that programmatically;
2. Insert the equation as plain text; or
3. programmatically use the Equation editor.
Obviously, (2) is the simplest.

So far I got to the point of adding a picture from matlab to a doc but there is no documentation and I have no idea how to move it.
If you insert an object with the in-line format at the desired location, it's a simple matter to change its text wrapping and have the object stay put (or move it about the page), rather than inserting one with text-wrapping then trying to move it to another page.