Automating "Compress" feature on all pics in Word doc with VB.

C

Chrisso

Hi All

In a Word document you can select a picture and then right click and
select "Format Picture".

On the "Picture" tab you then have the "Compress" button.

I want to automate with VB running this "Compress" feature for all the
pics in the document to a "Print" size.

When I record myself doing this the recorded macro seems to do
everything but what I want.

Does anyone have code for performing this action?

Chrisso
 
G

George Lee

For the sake of completeness, here’s a post from Cindy Meister (VSTO/Word MVP):

There's just some functionality that's not exposed in the Word object model,
especially a few things that have to do with the shared, Office graphics
stuff. Picture compression is one of these things. The best you can do is to
display the dialog box - by triggering the built-in command:
Make sure a valid picture is selected, then
app.CommandBars.FindControl(Id:=6382).Execute

You can try putting a Sendkeys in front of the above line, with an {Enter}
at the end of the keystrokes to confirm the dialog box. But that's the best
you can do.

(Note in response to Misha's suggestion: because this isn't exposed in the
object model, the macro recorder won't record any lines beyond the macro
name.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top