Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Please suppose you have a Microsoft Word 2007 document: you have just inserted in it about a thousand of JPEG images.

With the first image, you do right-click, then FORMAT PICTURE, then option "RECOLOR", and then select "BLACK AND WHITE" in the second row "COLOR MODES".

How can you automate the process of giving the same "format picture" command to the other 999 JPEG images?

I have just tried with FORMAT PAINTER, but I did not have success.

Any clues?

This is a similar QUESTION with NO ANSWERS: http://thedailyreviewer.com/windowsapps/view/formatting-all-pictures-in-a-word-document-in-one-go-11962810

How do I select all pictures in one go, for consistent formatting, so that they all appear the same throughout my word document, ie, so that they all have the same text wrapping margins, for example... and are all the same % size of the original? If word doesn't allow me to 'select all' for pictures, can I copy the formatting of the pics and then paste it over the other pics somehow, similar to the format brush used for text?

Thank you in advance for your kind help.

share|improve this question

migrated from stackoverflow.com May 13 '11 at 9:11

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers 2

up vote 7 down vote accepted

You can:

Dim Pic As InlineShape
For Each Pic In ActiveDocument.InlineShapes
  Pic.PictureFormat.ColorType = msoPictureGrayscale
Next
share|improve this answer
    
OK, but I wish to pass to "Black and White", and not Grayscale. How can I achieve this? –  UltraCommit May 11 '11 at 13:24
2  
Use msoPictureBlackAndWhite instead of msoPictureGrayscale but it will probably look terrible - the recolour option seems to use grayscale –  Alex K May 11 '11 at 13:39
    
Thank you very much for your kind suggestion. My original problem was the following: I have a PDF obtained transforming a PPT into PDF, with a horrible cyan background, and black characters. I have transformed the PDF into 100 JPEG files, I have included them into a Word 2007 document, and at last I have switched them to Black_and_White, removing the background and leaving only the black characters. Many thanks for your kind contribution ;-) –  UltraCommit May 11 '11 at 13:43
    
After migration of my question from stackoverflow to superuser, it was necessary to accept AGAIN your answer, Alex K: it sounds like very strange! Thank you AGAIN ;-) –  UltraCommit May 13 '11 at 9:25
add comment

Ok, many thanks to Alex K., the solution is the following:

Sub Macro1()
'
' Macro1 Macro
'
'
Dim Pic As InlineShape
For Each Pic In ActiveDocument.InlineShapes
  Pic.PictureFormat.ColorType = msoPictureBlackAndWhite
Next
End Sub

I have accepted Alex K. solution, because he found the right way to solve the problem. The right keyword is msoPictureBlackAndWhite instead of msoPictureGrayscale.

Many thanks, Alex K. ;-)

share|improve this answer
2  
Given the details you added in your second comment, msoPictureBlackAndWhite is, indeed, correct (you really do want stark Black and White). For most pictures, msoPictureGrayscale is preferrable, and that wasn't clear in the original question. +1 for credit where due. –  RolandTumble May 11 '11 at 18:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.