PDA

View Full Version : Compress Pictures OR NOT



dantzu
11-01-2012, 06:23 AM
Hi all,
I know similar threads have already been raised but none of them have adequate answer after all so I'm starting the topic again.
I'm trying to compress, through VBA, inserted images in a word 2007/2010 document. The web is full of suggestions using the following or similar to the following code:

With Application.CommandBars.FindControl(ID:=6382)
SendKeys "%A%W{Enter}"
.Execute
End With
The code executes the following window (Control 6382):
http://kulenski.eu/dl/efcc01.png

The disadvantage of this method is that it DOES NOTHING. It DOES NOT apply any compression to the images in the document, therefore it's useless.

The window (Control) that does the work is the following (for Word 2010):
http://kulenski.eu/dl/efcc02.png

Unfortunately I don't know if it has a control ID # and what it is. So far I've managed to manipulate it with the following code (after selecting one of the inserted pictures) for Word 2010. The code differs a little for Word 2007.

Sub Compress_Pics()
With Selection
SendKeys ("%JP")
SendKeys ("M")
SendKeys ("A")
SendKeys ("E") 'for 96 dpi
SendKeys ("{Enter}")
End With
End Sub


I know the second method is a bit of primitive but at least it's working one (for English version of Word only I guess)
If the first method should be working any idea what could be the problem not to apply any compression since it executes without any errors. Please be certain that the first method works before claiming that it does because I went mad trying it over and over again without any success.
If you have suggestion on the second method or any other that really works I would greatly appreciate it. Thanks in advance.